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