1. 字符串(string)
set key value [EX seconds] [PX milliseconds] [NX|XX]
EX seconds:为键设置秒级过期时间
PX milliseconds:为键设置毫秒级过期时间
NX:键必须不存在,才可以设置成功,用于添加
XX:键必须存在,才可以设置成功,用于更新
get key
mset key value
mget key
2. 哈希(Hash)
hset key field value
hget
hdel key field
hmget key field [field ...]
hmset key field value [field value ...]
hexists key field
hkeys key
hvals key
hgetall key
3. 列表(List)
rpush key value [value ...]
lpush key value [value ...]
4. 集合(Set)
sadd key member [member ...]
srem key member [member ...]
5. 有序集合(Sorted Set)
zadd key [NX|XX] [CH] [INCR] score member [score member ...]
zrem key member [member ...]
zscore key member
zrank key member
zrevrank key member
zrange key start stop [WITHSCORES]
zrevrange key start stop [WITHSCORES]