Memcached PHP Sessions

Steven Grimm sgrimm at facebook.com
Fri Feb 2 18:36:29 UTC 2007


Larry Leszczynski wrote:
> Is it also correct that, in the above case, memcached would purge the 
> oldest 1MB of data (which may not be expired), and leave newer items 
> in the cache even though they have already expired?

No. Expired items are removed before non-expired items are cycled out of 
the LRU queue.

However, there is some interaction between the slab allocator and the 
LRU logic that can alter that behavior somewhat -- basically there is a 
separate storage "bucket" for each range of sizes of object, and the 
expiration/LRU logic is only applied within a particular bucket. So, for 
example, you might see a large object get LRUed out to make room for a 
small object even though the small object has an expiration time in the 
past, simply because there's no room left in the large-object bucket. 
But you will only ever see that behavior when dealing with objects of 
different size classes, never for objects of the same size.

-Steve



More information about the memcached mailing list