UNLINK key [key ...]
redis> SET key1 "Hello" "OK" redis> SET key2 "World" "OK" redis> UNLINK key1 key2 key3 (integer) 2
Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
TYPE key
redis> SET key1 "value" "OK" redis> LPUSH key2 "value" (integer) 1 redis> SADD key3 "value" (integer) 1 redis> TYPE key1 "string" redis> TYPE key2 "list" redis> TYPE key3 "set"
Determine the type stored at key
TTL key
redis> SET mykey "Hello" "OK" redis> EXPIRE mykey 10 (integer) 1 redis> TTL mykey (integer) 10
Get the time to live for a key
TOUCH key [key ...]
redis> SET key1 "Hello" "OK" redis> SET key2 "World" "OK" redis> TOUCH key1 key2 (integer) 2
Alters the last access time of a key(s). Returns the number of existing keys specified.
RENAMENX key newkey
redis> SET mykey "Hello" "OK" redis> SET myotherkey "World" "OK" redis> RENAMENX mykey myotherkey (integer) 0 redis> GET myotherkey "World"
Rename a key, only if the new key does not exist
RENAME key newkey
redis> SET mykey "Hello" "OK" redis> RENAME mykey myotherkey "OK" redis> GET myotherkey "Hello"
Rename a key
PTTL key
redis> SET mykey "Hello" "OK" redis> EXPIRE mykey 1 (integer) 1 redis> PTTL mykey (integer) 1000
Get the time to live for a key in milliseconds
PEXPIREAT key milliseconds-timestamp
redis> SET mykey "Hello" "OK" redis> PEXPIREAT mykey 1555555555005 (integer) 1 redis> TTL mykey (integer) -2 redis> PTTL mykey (integer) -2
Set the expiration for a key as a UNIX timestamp specified in milliseconds
PEXPIRE key milliseconds
redis> SET mykey "Hello" "OK" redis> PEXPIRE mykey 1500 (integer) 1 redis> TTL mykey (integer) 1 redis> PTTL mykey (integer) 1499
Set a key's time to live in milliseconds
PERSIST key
redis> SET mykey "Hello" "OK" redis> EXPIRE mykey 10 (integer) 1 redis> TTL mykey (integer) 10 redis> PERSIST mykey (integer) 1 redis> TTL mykey (integer) -1
Remove the expiration from a key
KEYS pattern
redis> MSET firstname Jack lastname Stuntman age 35 "OK" redis> KEYS \*name\* 1) "firstname" 2) "lastname" redis> KEYS a?? 1) "age" redis> KEYS \* 1) "firstname" 2) "age" 3) "lastname"
Find all keys matching the given pattern
EXPIREAT key timestamp
redis> SET mykey "Hello" "OK" redis> EXISTS mykey (integer) 1 redis> EXPIREAT mykey 1293840000 (integer) 1 redis> EXISTS mykey (integer) 0
Set the expiration for a key as a UNIX timestamp
EXPIRE key seconds
redis> SET mykey "Hello" "OK" redis> EXPIRE mykey 10 (integer) 1 redis> TTL mykey (integer) 10 redis> SET mykey "Hello World" "OK" redis> TTL mykey (integer) -1
Set a key's time to live in seconds
EXISTS key [key ...]
redis> SET key1 "Hello" "OK" redis> EXISTS key1 (integer) 1 redis> EXISTS nosuchkey (integer) 0 redis> SET key2 "World" "OK" redis> EXISTS key1 key2 nosuchkey (integer) 2
Determine if a key exists
DUMP key
redis> SET mykey 10 "OK" redis> DUMP mykey "\u0000\xC0\n\t\u0000\xBEm\u0006\x89Z(\u0000\n"
Return a serialized version of the value stored at the specified key.
DEL key [key ...]
redis> SET key1 "Hello" "OK" redis> SET key2 "World" "OK" redis> DEL key1 key2 key3 (integer) 2
Delete a key