读读Redis的官网,学第一手的资料:Redid官方文档地址
或者看看书《Redis 深度历险: 核心原理和应用实践》
1、之前整理过2篇关于LRU的博客
024 Java实现LRU(Least recently used,最近最少使用)算法 之 LinkedHashMap
022 LRU算法用在哪些地方,LRU算法如何实现
2、Redis官网中关于LRU的描述
Approximated LRU algorithm
Redis LRU algorithm is not an exact implementation. This means that Redis is not able to
pick the best candidate for eviction, that is, the access that was accessed the furthest
in the past. Instead it will try to run an approximation of the LRU algorithm,
by sampling a small number of keys, and evicting the one that is
the best (with the oldest access time) among the sampled keys.
However, since Redis 3.0 the algorithm was improved to also take a pool of
good candidates for eviction. This improved the performance of the algorithm,
making it able to approximate more closely the behavior of a real LRU algorithm.
官网中说Redis用的是近似LRU算法。
|