`

redis 命令(1)

 
阅读更多

 

1. keys pattern  获取符合pattern规则的键名列表

            pattern 格式 ?匹配一个字符

                                 * 匹配任意个字符(包括0个)

                                 []匹配括号中任意字符,可以使用-表示范围,如a-z

                                 \X 匹配字符X,\为转义字符

 

localhost:6379> keys person*
1) "persons:1:stature"
2) "persons:1:queryTimes"
3) "persons:1:name"
4) "persons:1:data"
5) "persons:1:modifyTimes"
6) "persons:1:age"
7) "persons:sequence"
8) "persons:1:addTimes"

 

2.exists key 判断一个键是否存在:

localhost:6379> exists car:2
(integer) 1

 3. del key [key...] 删除一个或多个键

  

localhost:6379> del welcomeTip
(integer) 1

 4. type key 获取键的类型 ,返回值可能为string(字符串),hash (散列类型),list(列表类型),set(集合类型),zset(有序集合类型)

   

localhost:6379> type car:2
hash
localhost:6379> type address
string

 5.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics