Redis Pttl 命令
Redis 教程
· 2019-03-06 20:14:21
Redis Pttl 命令以毫秒为单位返回 key 的剩余过期时间。
语法
redis Pttl 命令基本语法如下:
redis 127.0.0.1:6379> PTTL KEY_NAME
可用版本
>= 2.6.0
返回值
当 key 不存在时,返回 -2 。 当 key 存在但没有设置剩余生存时间时,返回 -1 。 否则,以毫秒为单位,返回 key 的剩余生存时间。
注意:在 Redis 2.8 以前,当 key 不存在,或者 key 没有设置剩余生存时间时,命令都返回 -1 。
实例
# 不存在的 key redis> FLUSHDB OK redis> PTTL key (integer) -2 # key 存在,但没有设置剩余生存时间 redis> SET key value OK redis> PTTL key (integer) -1 # 有剩余生存时间的 key redis> PEXPIRE key 10086 (integer) 1 redis> PTTL key (integer) 6179
点击查看所有 Redis 教程 文章: https://www.codercto.com/courses/l/33.html
Host Your Web Site In The Cloud
Jeff Barr / SitePoint / 2010-9-28 / USD 39.95
Host Your Web Site On The Cloud is the OFFICIAL step-by-step guide to this revolutionary approach to hosting and managing your websites and applications, authored by Amazon's very own Jeffrey Barr. "H......一起来看看 《Host Your Web Site In The Cloud》 这本书的介绍吧!