Issue
We're using a memcache cluster as a session store for multiple webservers.
I'm curious, though, what the effect will be if we set a long session expiry and the memcache instances don't have a ton of RAM.
If memcache hits its memory limit, does it automatically free up RAM (and hence drop sessions)? Or something else?
Solution
Memcached will use least recently used (LRU) eviction to free up memory. For this reason Memcached, or any cache for that matter, should not be used for long lived sessions (it is fine for short lived sessions).
For long lived session you should use a permanent storage such as a database. If performance is an issue you can emulate write-through caching by caching the session queries (this is what Django's cached_db
session storage does for example). I am not aware of any write-through implementation in PHP but it is easy enough to implement.
Answered By - Sascha Trifunovic Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.