1.SET
2.GET
3.INCR
key对应的value必须为数字,否则报错。
调用INCR后,自动加1
4.expire
5
RPUSH
RPUSHfriends "Tom"RPUSH friends "Bob"
LPUSH
LRANGEgives a subset of the list.
LRANGEfriends 0 -1=> ["Sam","Tom","Bob"] LRANGE friends 0 1=> ["Sam","Tom"] LRANGE friends 1 2=> ["Tom","Bob"]LLEN returns the current length of the list.LLEN friends=> 3LPOP removes the first element from the list and returns it.LPOP friends=> "Sam"RPOP removes the last element from the list and returns it.RPOP friends=> "Bob"
6.set
SADD
SADDsuperpowers "flight"SADD superpowers "x-ray vision"SADD superpowers "reflexes"
SREM
SREMsuperpowers "reflexes"
SISMEMBER
SISMEMBERsuperpowers "flight"=> true SISMEMBER superpowers "reflexes"=> false
SMEMBERS
SMEMBERSsuperpowers=> ["flight","x-ray vision"]
SUNION
SADD
7.zset
The
ZADDhackers 1940 "Alan Kay"ZADD hackers 1953 "Richard Stallman"ZADD hackers 1965 "Yukihiro Matsumoto"ZADD hackers 1916 "Claude Shannon"ZADD hackers 1969 "Linus Torvalds"ZADD hackers 1912 "Alan Turing"
In
ZRANGEhackers 2 4=> ["Alan Kay","Richard Stallman","Yukihiro Matsumoto"]