Redis: Keys Cheat Sheet

Del Command

redis 127.0.0.1:6379> DEL KEY_NAME

Dump Command

redis 127.0.0.1:6379> DUMP KEY_NAME

Exists Command

redis 127.0.0.1:6379> EXISTS KEY_NAME

Expire Command

redis 127.0.0.1:6379> Expire KEY_NAME TIME_IN_SECONDS

Expireat Command

redis 127.0.0.1:6379> Expireat KEY_NAME TIME_IN_UNIX_TIMESTAMP

Pexpire Command

redis 127.0.0.1:6379> PEXPIRE KEY_NAME TIME_IN_MILLISECONDS

Pexpireat Command

redis 127.0.0.1:6379> PEXPIREAT KEY_NAME TIME_IN_MILLISECONDS_IN_UNIX_TIMESTAMP

Keys Command

redis 127.0.0.1:6379> KEYS PATTERN

Move Command

redis 127.0.0.1:6379> MOVE KEY_NAME DESTINATION_DATABASE

Persist Command

redis 127.0.0.1:6379> PERSIST KEY_NAME

PTTL Command

redis 127.0.0.1:6379> SET tutorialname redis OK

TTL Command

redis 127.0.0.1:6379> TTL KEY_NAME 

Random key Command

redis 127.0.0.1:6379> RANDOMKEY 

Rename Command

redis 127.0.0.1:6379> RENAME OLD_KEY_NAME NEW_KEY_NAME 

Renamenx Command

redis 127.0.0.1:6379> RENAMENX OLD_KEY_NAME NEW_KEY_NAME

Type Command

redis 127.0.0.1:6379> TYPE KEY_NAME 

Leave a Reply

Your email address will not be published. Required fields are marked *