Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Does Memcached's LRU Actually Mean?

Tags:

memcached

lru

Memcached says it uses an LRU queue to do eviction (with a few rules based around slab sizes mixed in.) When they say least-recently-used, are they referring to least recently stored or least recently read? Their documentation seems ambiguous here.

like image 436
dave mankoff Avatar asked Jun 23 '10 20:06

dave mankoff


1 Answers

Everywhere I've seen the term used, LRU has referred to the last access (read or write) rather than the last store.

This article confirms it:

The LRU algorithm ensures that the object that is removed is one that is either no longer in active use or that was used so long ago that it’s data is potentially out of date or of little value.

It goes on to talk about items which are in "active use" - which to me strongly implies that it's access rather than storage... you wouldn't talk about something "actively being stored" unless you're halfway through actually writing it.

like image 65
Jon Skeet Avatar answered Dec 29 '22 03:12

Jon Skeet