Will the LRU delete entries that have not been used for some amount of time?

后端 未结 2 1924
执笔经年
执笔经年 2020-12-13 16:03

When in memcache the available memory is full, memcache uses the LRU (last recently used) algorithm to free memory. My question is will the LRU Algorithm rather delete entri

2条回答
  •  醉酒成梦
    2020-12-13 16:44

    From what I know this statement is not true.

    "Back to your question, when memory is full and you try to store an item, memcached will look first for expired items in the slab you are trying to write to, then look for the least used items. So yes, it does take into account the expiry of the keys, or better yet, expired keys go first before LRU."

    Memcache will evict item according to LRU (it doesn't matter if it has any expired items as long as they are more recently used than another key (even valid)).

    Tested a while ago on Memcache 1.4.4.

提交回复
热议问题