78144666 发表于 2016-12-19 10:50:05

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 删除一个或多个键

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.
页: [1]
查看完整版本: redis 命令(1)