Jump to content

memcaching in php


ala888

Recommended Posts

So I heard about memcache and how people utilize it to store data in ram for faster access, say for example, the results of a query from a MYSQL server. But my question is, what is the point? Cant you just store the resultant data in an arbitrary variable in the php script itself, which would also be essentially in ram? Or does memcache actually keep the retrieved value across multiple php instances or something?(that would be the only reason I can think of it exists, but Im not sure about my statement)

Link to comment
Share on other sites

right, once a PHP script executes, it dies, and SESSION only exists per user. their docs give a pretty good overview of it, so you can read all about it there.

http://memcached.org/about

Link to comment
Share on other sites

Memcached is similar to a database that only exists in RAM. A use case would be statistics for a website. Instead of calculating the statistics every time anyone visits the site, you calculate them once and store them in RAM. Everyone else reads them from RAM. If something happens to change the statistics then you calculate them again and save them in RAM again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...