GET parameter
SET xyz: "something"
INCR xyz
increments integer by one atomicallydel xyz
deletes a collectionEXPIRE resource:lock 120
time specified for it to expire in secondsTTL resource:Lock
checks for time remaining for a key to exist The -2 for the TTL of the key means that the key does not exist (anymore). A -1 for the TTL of the key means that it will never expire. Note that if you SET a key, its TTL will be reset.Rpush parameter
places the object at the end of the list;Lpush
places the object at the beginning of the list;LRANGE
gives a subset of the list. It takes the index of the first element you want to retrieve as its first parameter and the index of the last element you want to retrieve as its second parameter. A value of -1 for the second parameter means to retrieve elements until the end of the list.LLEN
returns the length of the listLPOP
returs the list with the first element removedRPOP
returns the list with the last element removedSADD
: adds value to a setSREM
: removes value from a setSISMEMBER
: checks if value is a member of a setSMEMBERS
: returns members of the setSUNION
: combines sets and returns all their elementsHSET
user:1000 name "John Smith"HSET
user:1000 email "john.smith@example.com"HSET
user:1000 password "s3cret"HMSET
user:1001 name "Mary Jones" password "hidden" email "mjones@example.com"HGETALL
user:1000
HSET user:1000 visits 10
HINCRBY user:1000 visits 1
=> 11
HINCRBY user:1000 visits 10
=> 21
HDEL user:1000 visits
HINCRBY user:1000 visits 1
=> 1