Useful Redis commands

Useful Redis commands

Some useful commands you can run with the redis-cli command. To use these, ssh into one of the cache or web servers and type the command.

# Get number of keys in cache

redis-cli dbsize

  

# Flush all keys (don't run this on live!)

redis-cli flushall

  

# List all keys

redis-cli keys "*"

  

# Search keys

redis-cli keys "*panels*"

 

# View a key's value

redis-cli hgetall mykey

  

# Delete a specific key

redis-cli del "phoenix-redis:cache:atd3_ticket_prices_10_710_277141"

  

# Delete keys matching a pattern

redis-cli keys "*panels*" | xargs redis-cli del

  

# Monitor activity

redis-cli

monitor

  

# List a key's type

redis-cli type mykey

  

# List the contents of a hash key

redis-cli hgetall phoenix-redis:cache:locale:pt-br

blog tag: