Redis PERSIST 命令

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

Redis PERSIST 命令用于移除给定 key 的过期时间,使得 key 永不过期。

语法

redis 127.0.0.1:6379> PERSIST KEY_NAME

返回值

  • 当过期时间移除成功时,返回 1 。

  • 如果 key 不存在或 key 没有设置过期时间,返回 0 。

实例

127.0.0.1:6379> setex domain 300 www.codercto.com
OK
127.0.0.1:6379> ttl domain
(integer) 296
127.0.0.1:6379> persist domain
(integer) 1
127.0.0.1:6379> ttl domain
(integer) -1
127.0.0.1:6379> get domain
"www.codercto.com"

# key 没有过期时间
127.0.0.1:6379> persist domain
(integer) 0

# key 不存在
127.0.0.1:6379> persist domain1
(integer) 0

查看更多 Redis key 命令

Database Design and Implementation

Database Design and Implementation

Edward Sciore / Wiley / 2008-10-24 / 1261.00 元

* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!

在线进制转换器

在线进制转换器

各进制数互转换器

URL 编码/解码

URL 编码/解码

URL 编码/解码