Redis 数据类型及操作

1.字符串

set key value [expiration EX seconds|PX milliseconds] [NX|XX]
get key

exists key [key ...]
del key

2.哈希

hset key field value
hget key field

hmset key field value [field value ...]
hmget key field [field ...]

hexists key field    
hdel key field [field ...]
hlen key

3.列表

lpush key value [value ...]
rpush key value [value ...]
lrange key start stop

lpop key
rpop key
llen key

4.集合

sadd key member [member ...]
smembers key

5.有序集合

zadd key [NX|XX] [CH] [INCR] score member [score member ...]
zrange key start stop [WITHSCORES]
zrangebyscore key min max [WITHSCORES] [LIMIT offset count]

其他常用命令

keys *
flushdb
flushall
ping