redis 数据淘汰策略与配置

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 ,当数据达到限定大小后,会选择配置的策略淘汰数据

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值