当前位置: 移动技术网 > IT编程>数据库>MongoDB > redis中key键操作

redis中key键操作

2020年03月09日  | 移动技术网IT编程  | 我要评论

keys */查看所有的key

remoteself:1>select 0
"ok"
remoteself:0>keys *
 1)  "subcribemap"
 2)  "test"

exists key名字/判断某个key是否存在

# 不存在返回0
remoteself:0>exists aaa
"0"
# 存在返回1
remoteself:0>exists test
"1"

move key db/将可以从当前库移动到库db

expire key 秒数/为给定的key设置过期时间

ttl key/查看key还有多长时间过期,-1表示永不过期,-2不是已经过期

type key/查看key是什么类型

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网