Redis学习总结之健值常用命令
Keys
返回满足给定pattern的所有key
*表示取出所有的key
exists
确认一个key是否存在,存在返回1,不存在返回0
del
删除一个key
expire
设置一个key的过期时间
在本例中,我们设置addr这个key的过期时间是10秒,然后我们不断的用ttl来获取这个key的有效时长,直至为-1说明此值已过期
select
选择数据库
move
将当前数据库中的key转移到其他数据库中
persist
移除给定key的过期时间
randomkey
随机返回key空间的一个key
rename
重命名key
type
返回值的类型