Cache Expiry

Erik Mogensen mogsie at escenic.com
Sat Nov 5 15:07:42 PST 2005


>> What basis does it use to work out which records to purge?
>> ie: How long ago they were last requested? Random?
> 
> iirc it's uses a plain old LRU (least recently used) approach. So the  
> oldest things get wiped first.

I just wanted to point out the common mistake of describing LRU as the "oldest things get wiped first" -- You probably know that the correct description is a bit more complex.  Memcached takes the items that haven't been accessed in eons, and wipes them.  The _oldest_ items are usually quite popular; and a lot of items only get put in the cache and are never accessed again.

I once did a demographic chart of a (non-memcached) cache which showed roughly 1/3 "popular but very old" items, 1/3 semi-popular, and 1/3 on what I would call "death row" marching their way to the end of the LRU-queue.
-- 
-mogsie-



More information about the memcached mailing list