redis 數據淘汰策略與配置


redis 數據淘汰策略

volatile-lru:從已設置過期的數據集中挑選最近最少使用的淘汰
volatile-ttr:從已設置過期的數據集中挑選將要過期的數據淘汰
volatile-random:從已設置過期的數據集中任意挑選數據淘汰
allkeys-lru:從數據集中挑選最近最少使用的數據淘汰
allkeys-random:從數據集中任意挑選數據淘汰
noenviction:禁止淘汰數據
redis淘汰數據時還會同步到aof中、從機


配置文件 

# maxmemory <bytes>
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key according 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
# The default is:
# maxmemory-policy noeviction
我們可以設置maxmemory <bytes>,當數據達到限定大小后,會選擇配置的策略淘汰數據


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM