1, String type
Set name Zhangsan # setting name (key) to Zhangsan (value)
Get name #获取key的值
exists name #判断name是否存在
Del name #删除键值 name
Type name #获取name的类型
INCR sum #如果键 sum does not exist then create an initial value of 1 if it exists then add one if it is not an integer type then an error
Incrby sum #与incr类似 sum+12
DECR sum #与incr相反 minus 1
Decrby Sum #sum-12
Incrbyfloat Sum 0.2 # sum+0.2
Append name ' is ' #尾部添加 is
Strlen name #获取name的长度
Mget name Sum #同时获取多个键
Mset name Lisi sum 1110 #同时设置多个值
"Del supports wildcards to remove all conforming rules here you can see http://www.cnblogs.com/mintworld/p/5729805.html"
2. Hash hash type
Storage mode if everything is the same as the object, the command is as follows
Hset person:1 Height 175
Hset Person:1 Weight 120
Hset Person:1 Age 28
Hget Person:1 Age #获取age
Or
Hmset person:1 Height 175 Weight 28
Hmget person:1 Height Weight age
Hgetall Person:1
Hexists Person:1 Age # Determines whether a key field exists
Hsetnx Person:1 Age 120 # If age exists then nothing action does not exist Create field assignment to field
Hincrby person:1 Age 1 #如果字段age存在则 age+1 create a field if it does not exist and assign a value of 1 if the type is not additive, the error
Hdel person:1 Age Height #删除一个或多个字段
Hkeys Person:1 #获取所有的字段
Hvals Person:1 #获取所有的字段值
Hlen Person:1 #获取字段数量
3. List Type
Lpush message Cust:123:hello #放入列表左侧
Rpush message Cust:123:hello #放入列表右侧
Lpop message #从左边弹出一个值
Rpop message #从右侧弹出一个值
Llen message #获取元素的个数
Lrange message 0-1 #从第一个取出到最后一个
Lrem Message 2 1 #删除前两个值中为1的值 >0 from the left side <0 from the right = 0 Remove all values of 1
Lindex Message 2 #获取值为2的下标 starting from 0
LSet Message 0 Zhangsan #设置第一个值为zhangsan
LTrim Message 1 8 #只保留下标从1到8的值其余剪切掉
Linsert message after the 1 #在message中从0开始找到值为114然后在后面插入一个1 after another is before
Rpoplpush message Ceshi #从message右侧取出一个值放入 to the left of the test
Redis Data Operations Command Summary (string hash list)