redis中key键操做

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是什么类型

相关文章
相关标签/搜索