如何设置redis的过期策略

在redis.conf中有如下配置

# 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

选择自己想要的关闭注释就行

你可能感兴趣的:(如何设置redis的过期策略)