#设置值
127.0 .0 .1 :6379 > set a1 1
OK
#键对应的值
127.0 .0 .1 :6379 > get a1
"1"
#删除键对应的值
127.0 .0 .1 :6379 > DEL a1
(integer) 1
127.0 .0 .1 :6379 > get a1
(nil)
127.0 .0 .1 :6379 > HMSET h1 f1 v1 f2 v2
OK
127.0 .0 .1 :6379 > HGETALL h1
1 ) "f1"
2 ) "v1"
3 ) "f2"
4 ) "v2"
127.0 .0 .1 :6379 > HSET h1 f3 3
(integer ) 1
127.0 .0 .1 :6379 > HGETALL h1
1 ) "f1"
2 ) "v1"
3 ) "f2"
4 ) "v2"
5 ) "f3"
6 ) "3"
127.0 .0 .1 :6379 > HINCRBY h1 f3 1
(integer ) 4
127.0 .0 .1 :6379 > HGETALL h1
1 ) "f1"
2 ) "v1"
3 ) "f2"
4 ) "v2"
5 ) "f3"
6 ) "4"
127.0 .0 .1 :6379 > HINCRBY h1 f3 -1
(integer ) 3
127.0 .0 .1 :6379 > HGETALL h1
1 ) "f1"
2 ) "v1"
3 ) "f2"
4 ) "v2"
5 ) "f3"
6 ) "3"
#列表
127.0 .0 .1 :6379 > LPUSH a3 test1 #列表左边添加
(integer) 1
127.0 .0 .1 :6379 > LPUSH a3 test2
(integer) 2
127.0 .0 .1 :6379 > RPUSH a3 test3 #列表右边添加
(integer) 3
127.0 .0 .1 :6379 > LRANGE a3 0 -1
1 ) "test2"
2 ) "test1"
3 ) "test3"
#分页,每页3条记录
127.0 .0 .1 :6379 > LRANGE a3 0 -1
1 ) "test2"
2 ) "test1"
3 ) "test3"
4 ) "test4"
5 ) "test5"
6 ) "test6"
7 ) "test7"
8 ) "test8"
9 ) "test9"
#第一页:LRANGE a3 0 2
#第二页:LRANGE a3 3 5
#排序 ALPHA安字母排序
127.0 .0 .1 :6379 > SORT a3 ALPHA
1 ) "test1"
2 ) "test2"
3 ) "test3"
4 ) "test4"
5 ) "test5"
6 ) "test6"
7 ) "test7"
8 ) "test8"
9 ) "test9"
127.0 .0 .1 :6379 > SORT a3 desc ALPHA
1 ) "test9"
2 ) "test8"
3 ) "test7"
4 ) "test6"
5 ) "test5"
6 ) "test4"
7 ) "test3"
8 ) "test2"
9 ) "test1"
#带分页排序
127.0 .0 .1 :6379 > SORT a3 desc ALPHA limit 0 3
1 ) "test9"
2 ) "test8"
3 ) "test7"
127.0 .0 .1 :6379 > ZADD a4 1 test1
(integer ) 1
127.0 .0 .1 :6379 > ZADD a4 2 test2
(integer ) 1
127.0 .0 .1 :6379 > ZADD a4 3 test3
(integer ) 1
127.0 .0 .1 :6379 > ZADD a4 4 test4
(integer ) 1
127.0 .0 .1 :6379 > ZRANGE a4 0 -1
1 ) "test1"
2 ) "test2"
3 ) "test3"
4 ) "test4"