redis-过期时间

1、设置

设置name值为zhangsan

set  name   zhangsan

name过期时间为1000秒

expire name 1000

2、查看key的剩余过期时间

ttl  name

返回:

(1)xx 剩余xx秒

(2)-1   永久不过期

(3)-2   key不存在

3、取消键的过期时间

persist name

或者重新设置key值也可以取消过期时间

set name lisi

**********************技术交流请 email:cuihao0532#163.com 欢迎转载,转载请注明出处!***************************** 如果对本文满意请扫描文章左侧【二维码添加微信】获取更多好玩、有趣、有益、有营养的料, 你我共同成长!Y(^_^)Y
原文地址:https://www.cnblogs.com/cuish/p/15096836.html