What happens when redis server gets turned off?
What real cases can redis improve comparing to relational DB?
What 5 redis data structure exists?
STRINGs, LISTs, SETs, HASHes, and ZSETs (sorted set)
How to add/get/remove string value in redis?
set mykey ‘hello’
get mykey
del mykey
How to get/add/remove values from the redis list?
rpush my_list 1 2 3
lindex my_list 0 # 1
lrange my_list 0 2 # 1 2 3
lpop my_list # removes first value from the left
rpop my_list # removes first value from the right
How to get/add/remove values from the redis set?
sadd my_set 1 sadd my_set 2 sadd my_set 3 srem my_set 3 smembers my_set # 1 2 sismember my_set 32 # 0
How to get/add/remove values from the redis hash?
hset my_hash key 12 hset my_hash key2 12 hget my_hash key hdel my_hash key hgetall my_hash # returns all
How to implement pub/sub in redis?
SUBSCRIBE channel
PUBLISH channel ‘Hello message’
How to use transaction in Redis?
MULTI
set key ‘hello’
….
EXEC
What is snapshot drawback?