在Redis中,如果设置的maxmemory,那就要配置key的回收机制参数maxmemory-policy,默认volatile-lru,参阅Redis作者的原博客:antirez weblog Redis as an LRU cache
原文中写得很清楚:
复制代码 代码如下:
Another way to use Redis as a cache is the maxmemory directive, a feature that allows specifying a maximum amount of memory to use. When new data is added to the server, and the memory limit was already reached, the server will remove some old data deleting a volatile key, that is, a key with an EXPIRE (a timeout) set, even if the key is still far from expiring automatically.
在Redis服务器占用内存达到maxmemory的情况下,当再想增加内存占用时,会按maxmemory-policy机制将老的数据删除。这里简单说一下volatile-lru,Redis会按LRU算法删除设置了过期时间但还没有过期的key,而对于没有设置过期时间的key,Redis是永远保留的。当然,如果你不想删除没有过期的key,那可以使用noeviction机制
复制代码 代码如下:
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached? You can select among five behavior:
#
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys-random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 张靓颖.2009-@音乐【华谊兄弟】【WAV+CUE】
- dnf缝纫机是必得一套吗
- dnf时装裤子身上穿的算吗
- dnf最高等级
- 《蟹蟹寻宝奇遇》评测:小蟹寻家记
- 《剑星》评测:油腻师姐炒的功夫菜,欠点火候
- 杉果福袋¥35.8抽《庄园领主》《地狱潜兵2》
- Bruckner-SymphoniesNos.56-NewPhilharmoniaOrchestra,OttoKlemperer(2024)[24-192]FLA
- 群星《梦舞池3》WAV分轨
- 黄凤凤.2011-丽风金典系列VOL.1【丽风】2cd【WAV+CUE】
- 大部分情侣是食色性也的酒肉情侣 3D区X光片的囧图
- 《崩坏:星穹铁道》迎一周年!登陆游戏送10连抽
- 布兰妮与父亲达成和解:需向父亲支付200多万法律费
- Taylor Swift霉霉《THE TORTURED POETS DEPARTMENT THE ANTHOLOGY》[FLAC][766M]
- 潘美辰《金歌点唱 HDCD 》[WAV+CUE][603M]