redis筆記

設置redis最大佔用內存java

# 編輯redis配置文件,加入最大內存使用限制,我根據服務器的狀況設置爲3G
maxmemory 3221225472

  

設置redis數據過時策略:redis

redis中有6種過時策略:
# 根據LRU算法生成的過時時間來刪除
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# 根據LRU算法刪除任何key。
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# 根據過時設置來隨機刪除key。
# volatile-random -> remove a random key with an expire set
# 無差異隨機刪。
# allkeys-random -> remove a random key, any key
# 根據最近過時時間來刪除(輔以TTL)
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# 誰也不刪,直接在寫操做時返回錯誤。
相關文章
相關標籤/搜索