Show slow query log redis
Last 20 slow commands with execution time in microseconds
redis-cli SLOWLOG GET 20
more redis
all 32 commands →
Memory usage per key pattern
redis-cli --scan --pattern 'session:*' | xargs -n1 redis-cli MEMORY USAGE | awk '{sum+=$1} END{print sum/1024/1024" MB"}'
Delete keys by pattern
redis-cli --scan --pattern 'cache:*' | xargs -r redis-cli DEL
Set key with TTL
redis-cli SET mykey 'value' EX 3600
Increment counter
redis-cli INCRBY counter:hits 1
Pub/Sub publish
redis-cli PUBLISH events '{"type":"login","user":"alice"}'