ala888 Posted July 17, 2014 Share Posted July 17, 2014 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 More sharing options...
thescientist Posted July 17, 2014 Share Posted July 17, 2014 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 More sharing options...
ala888 Posted July 18, 2014 Author Share Posted July 18, 2014 So memcache to store a variable would be the ram equivalent of writing and reading from a textfile from disk? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2014 Share Posted July 21, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now