Redis--keys的通用操作
生活随笔
收集整理的這篇文章主要介紹了
Redis--keys的通用操作
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
##1.獲取全部key
命令:keys *
##2.獲取全部以某個字符開頭的key
命令:keys 字符*
##3.刪除某個或者某些key
命令:del key1 key2 key3 ...
##4.檢查某個key是否存在----0:不存在;1:存在
127.0.0.1:6379> keys * 1) "myHash" 2) "myHahs" 127.0.0.1:6379> exists myHash (integer) 1 127.0.0.1:6379> exists id (integer) 0 127.0.0.1:6379>##5.對key進行重命名
127.0.0.1:6379> keys * 1) "id" 2) "myHash" 127.0.0.1:6379> get id "100" 127.0.0.1:6379> rename id newId OK 127.0.0.1:6379> get id (nil) 127.0.0.1:6379> get newId "100" 127.0.0.1:6379>##6.對key設置過期時間
expire key 時間(單位:秒)
##7.查看某個key所剩的超時時間
命令:ttl key
##8.獲取指定key的類型
127.0.0.1:6379> keys * 1) "newId" 2) "myHash" 127.0.0.1:6379> type newId string 127.0.0.1:6379>轉載于:https://my.oschina.net/u/2312022/blog/1558322
總結
以上是生活随笔為你收集整理的Redis--keys的通用操作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 十铨推出新款 PCIe 5.0 SSD:
- 下一篇: linux cmake编译源码,linu