“`” redis 配置文件 redis.conf 中有相关注释,大家可以自行查阅或者通过这个网址查看: http://download.redis.io/redis-stable/redis.conf
<strong>redis 提供 6种数据淘汰策略:</strong>
<ol><li><strong>volatile-lru</strong>:从已设置过期时间的数据集(server.db[i].expires)中挑选最近最少使用的数据淘汰</li><li><strong>volatile-ttl</strong>:从已设置过期时间的数据集(server.db[i].expires)中挑选将要过期的数据淘汰</li><li><strong>volatile-random</strong>:从已设置过期时间的数据集(server.db[i].expires)中任意选择数据淘汰</li><li><strong>allkeys-lru</strong>:当内存不足以容纳新写入数据时,在键空间中,移除最近最少使用的key(这个是最常用的)</li><li><strong>allkeys-random</strong>:从数据集(server.db[i].dict)中任意选择数据淘汰</li><li><strong>no-eviction</strong>:禁止驱逐数据,也就是说当内存不足以容纳新写入数据时,新写入操作会报错。这个应该没人使用吧!</li></ol>
4.0版本后增加以下两种:
<ol><li><strong>volatile-lfu</strong>:从已设置过期时间的数据集(server.db[i].expires)中挑选最不经常使用的数据淘汰</li><li><strong>allkeys-lfu</strong>:当内存不足以容纳新写入数据时,在键空间中,移除最不经常使用的key</li></ol>
<pre><code> "“`
Was this helpful?
0 /
0