Redis Expire 命令
Redis 教程
· 2019-03-06 18:27:36
Redis Expire 命令用于设置 key 的过期时间,key 过期后将不再可用。单位以秒计。
语法
redis Expire 命令基本语法如下:
redis 127.0.0.1:6379> Expire KEY_NAME TIME_IN_SECONDS
可用版本
>= 1.0.0
返回值
设置成功返回 1 。 当 key 不存在或者不能为 key 设置过期时间时(比如在低于 2.1.3 版本的 Redis 中你尝试更新 key 的过期时间)返回 0 。
实例
首先创建一个 key 并赋值:
redis 127.0.0.1:6379> SET runooobkey redis OK
为 key 设置过期时间:
redis 127.0.0.1:6379> EXPIRE runooobkey 60 (integer) 1
以上实例中我们为键 runooobkey 设置了过期时间为 1 分钟,1分钟后该键会自动删除。
点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html
The Seasoned Schemer
Daniel P. Friedman、Matthias Felleisen / The MIT Press / 1995-12-21 / USD 38.00
drawings by Duane Bibbyforeword and afterword by Guy L. Steele Jr.The notion that "thinking about computing is one of the most exciting things the human mind can do" sets both The Little Schemer (form......一起来看看 《The Seasoned Schemer》 这本书的介绍吧!