expire

英 [ɪkˈspaɪə(r)]   美 [ɪkˈspaɪr]  

vi.期满;文件、协议等(因到期而)失效;断气;逝世

第三人称单数: expires 现在分词: expiring 过去式: expired 过去分词: expired

redis EXPIREAT命令 语法

作用:EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置生存时间。不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。

语法:EXPIREAT key timestamp

可用版本:>= 1.2.0

时间复杂度:O(1)

返回:如果生存时间设置成功,返回 1 。当 key 不存在或没办法设置生存时间,返回 0 。

redis EXPIREAT命令 示例

redis> SET cache www.google.com
OK
redis> EXPIREAT cache 1355292000     # 这个 key 将在 2012.12.12 过期
(integer) 1
redis> TTL cache
(integer) 45081860