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

posted @ 2020-02-07 15:41  未月廿三  阅读(356)  评论(0编辑  收藏  举报