Redis Expireat 命令

Redis 教程 · 2019-03-06 18:44:04

Redis Expireat 命令用于以 UNIX 时间戳(unix timestamp)格式设置 key 的过期时间。key 过期后将不再可用。

语法

redis Expireat 命令基本语法如下:

redis 127.0.0.1:6379> Expireat KEY_NAME TIME_IN_UNIX_TIMESTAMP

可用版本

>= 1.0.0

返回值

设置成功返回 1 。 当 key 不存在或者不能为 key 设置过期时间时(比如在低于 2.1.3 版本的 Redis 中你尝试更新 key 的过期时间)返回 0 。

实例

首先创建一个 key 并赋值:

redis 127.0.0.1:6379> SET coderctokey redis
OK

为 key 设置过期时间:

redis 127.0.0.1:6379> EXPIREAT coderctokey 1293840000
(integer) 1
EXISTS coderctokey
(integer) 0

点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html

标签: expireat

Introduction to Computer Science Using Python

Introduction to Computer Science Using Python

Dierbach, Charles / 2012-12 / $ 133.62

Introduction to Computer Science Using Python: A Computational Problem-Solving Focus introduces students to programming and computational problem-solving via a back-to-basics, step-by-step, objects-la......一起来看看 《Introduction to Computer Science Using Python》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换