redis笔记

设置redis最大占用内存

# 编辑redis配置文件,加入最大内存使用限制,我根据服务器的情况设置为3G
maxmemory 3221225472

  

设置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)
# 谁也不删,直接在写操作时返回错误。

  

 

posted on 2019-08-28 23:56  上校  阅读(234)  评论(0编辑  收藏  举报