Redis中常用的五种数据类型:
1、字符串(String)
2、字符串列表(List)
3、有序字符串集合(Sorted list)
4、哈希(Hash)
5、字符串集合(Set)
一、存储String常用的命令
a.赋值set
b,取值get
c.删除del
d.数值增减incr/decr/incrby/decrby
e.扩展命令append
root@iZf8zgmcqbodq6fb8j8k54Z redis]# ./bin/redis-cli
127.0.0.1:6379> set girl Pretty
OK
127.0.0.1:6379> get girl
"Pretty"
127.0.0.1:6379> getset girl Lovely
"Pretty"
127.0.0.1:6379> get girl
"Lovely"
127.0.0.1:6379> set boy Hot
OK
127.0.0.1:6379> get boy
"Hot"
127.0.0.1:6379> del boy
(integer) 1
127.0.0.1:6379> get boy
(nil)
127.0.0.1:6379> incr num
(integer) 1
127.0.0.1:6379> get num
"1"
127.0.0.1:6379> incr num
(integer) 2
127.0.0.1:6379> get num
"2"
127.0.0.1:6379> decr num
(integer) 1
127.0.0.1:6379> get num
"1"
127.0.0.1:6379> decr num2
(integer) -1
127.0.0.1:6379> incrby num 5
(integer) 6
127.0.0.1:6379> decrby num 2
(integer) 4
127.0.0.1:6379> get num
"4"
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> append num 4
(integer) 2
127.0.0.1:6379> get num
"44"
127.0.0.1:6379>