先上结论,一般是永不过期的

在使用redis的时候,突然想起这个问题,然后查了下【1】,redis的缓存内容默认是永不过期的。后面如果有时间,我再仔细看下相关内容,写在这里。

后记,
在看redis文档的时候,看到了这么一句话:

Keys with an expire

Normally Redis keys are created without an associated time to live. The key will simply live forever, unless it is removed by the user in an explicit way, for instance using the DEL command.【3】

参考资料:
【1】,redis默认过期时间:redis默认的是永不过期
【2】,Redis 内存淘汰机制
【3】,redis官方文档

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐