Redis syntax
From wikinotes
This page describe's redis' native protocol.
Libraries may abstract it, but the base featureset is exposed here.
Commands
Introspection
KEYS '*' # list all keys TYPE key # return type of key EXISTS key # return 1 if exists TTL key # show key's TTLCreate/Set/Get
# delete DEL key # delete key # set SET foo 1 # set key 'foo' to value 'bar' MSET key-1 val-1 key-2 val-2 ... # set multiple keys at once # get GET foo # get val of key 'foo' MGET # special setters SETNX foo 1 # set key 'foo' if not exists INCR foo # +1 key value GETSET foo bar # set 'foo' to 'bar' and return prev value of 'foo'TTL
EXPIRE foo 5 # key 'foo' will be deleted in 5s SET foo bar ex 5 # key 'foo' set to 'bar', and will be deleted in 5s