Add element operation of redis

-------------"Increase" operation of key of collection type---------------------------- ---------------
If set1 does not exist, create a new key as set1, specify the type as set, and add the element yuchi
SADD set1 yuchi


------------ - "Increase" operation of string type key ----------------------- ---
127.0.0.1:6379> set data_string jwieofios
OK
127.0.0.1:6379> get data_string
"jwieofios"


------------- "Increase" operation of key of type list---- --------------------------------------
127.0.0.1:6379> LPUSH data_list redis
(integer) 4
127.0.0.1:6379> LRANGE data_list 0 10
1) "redis"
2) "rabbitmq"
3) "haha"
4) "redis"






--------------hash type key "increase" operate----------------------------------------
127.0.0.1:6379> hmset myhash  user4 6000 user5 7000
OK
127.0.0.1:6379> hgetall myhash
 1) "field2"
 2) "World"
 3) "yuchi"
 4) "666"
 5) "yuchixxx"
 6) "8789"
 7) "yuchiXXX"
 8) "989"
 9) "ppp"
10) "iii"
11) "user4"
12) "6000"
13) "user5"
14) "7000"
127.0.0.1:6379> hmget myhash field2
1) "World"
127.0.0.1:6379> hmget myhash world
1) (nil)
127.0.0.1:6379> hmget myhash user4
1) "6000"
Here we can see that the key-value pairs in a key (data set) are stored in order. In the above example, user5 is the key and 7000 is the value.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325985823&siteId=291194637