redis-cli cheatsheet

Install redis with cli

brew install redis

Commands

redis-cli -h your-cluster-endpoint -p your-cluster-port

# all keys
keys *

# pattern
keys prefix-*

# key type
type <key>

# get string key
get <key>

# get all hash key
hgetall <key>

# expiration time in seconds
# -2 if key doesn't exist
# -1 if key doesn't expire
ttl <key>