Please enable JavaScript.
Coggle requires JavaScript to display documents.
Redis - Coggle Diagram
Redis
List
-
RPUSH, rpush mylist A, rpush mylist B
-
-
-
Blocking List
BRPOP, BLPOP: blocking version of pop
String
SET, GET, to set or get a string by key: set mykey newval
INCR, INCRBY, DECR, DECRBY to increase/decrease a value by 1 or specified number
MSET, MGET to batch set/get value
-
-
Key
Binary safe, image can be key
-
Limited Time to live: ttl. set key 100 ex 10,
ttl key (check the remaining time),
Hashes
HMSET: set multiple fields of the hash, hmset user:1000 username antirez birthyear 1977 verified 1
-
HMGET: return an array of values, hmget user:1000 username birthyear no-such-field
-
Sorted Set
ZADD: zadd hackers 1940 "Alan Kay", As you can see ZADD is similar to SADD, but takes one additional argument (placed before the element to be added) which is the score
-
-
-
-
Automatic creation and removal of keys:
create empty lists before pushing elements, or removing empty lists when they no longer have elements inside
-