当前位置:网站首页>First understand redis' data structure - string

First understand redis' data structure - string

2022-06-24 19:52:00 just_ peanut

Redis Five data types commonly used in :
1、 character string (String)
2、 String list (List)
3、 Ordered string collection (Sorted list)
4、 Hash (Hash)
5、 String collection (Set)

One 、 Storage String Common commands
a. assignment set
b, Value get
c. Delete del
d. Increase or decrease in value incr/decr/incrby/decrby
e. The extension command append

[email protected] 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>

原网站

版权声明
本文为[just_ peanut]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211328051911.html