Redis Expire 命令

更新时间: 2019-07-07 15:54

Redis Expire 命令用于设置 key 的过期时间,key 过期后将不再可用。单位以秒计。

语法

redis 127.0.0.1:6379> Expire KEY_NAME TIME_IN_SECONDS

返回值

设置成功返回 1 。 当 key 不存在或者不能为 key 设置过期时间时返回 0 。

实例

实例1:

127.0.0.1:6379> exists domain
(integer) 1
127.0.0.1:6379> expire domain 120
(integer) 1
127.0.0.1:6379> ttl domain
(integer) 117

实例2:当 key 不存在

127.0.0.1:6379> exists domain2
(integer) 0
127.0.0.1:6379> expire domain2 120
(integer) 0

查看更多 Redis key 命令

The Web Designer's Idea Book

The Web Designer's Idea Book

Patrick Mcneil / How / 2008-10-6 / USD 25.00

The Web Designer's Idea Book includes more than 700 websites arranged thematically, so you can find inspiration for layout, color, style and more. Author Patrick McNeil has cataloged more than 5,000 s......一起来看看 《The Web Designer's Idea Book》 这本书的介绍吧!

XML、JSON 在线转换

XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换

UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具

HSV CMYK 转换工具

HSV CMYK互换工具