TTL of a key
Remaining TTL in seconds; -1 = no expiry, -2 = not found
redis-cli -h redis TTL <key>
- tool
- redis32 commands
More redis commands
-
redis-cli MONITOR | grep -v PINGStream every command sent to Redis (exclude health pings)
-
redis-cli SLOWLOG GET 20Last 20 slow commands with execution time in microseconds
-
redis-cli --scan --pattern 'session:*' | xargs -n1 redis-cli MEMORY USAGE | awk '{sum+=$1} END{print sum/1024/1024" MB"}'Total memory consumed by keys matching a pattern
-
redis-cli --scan --pattern 'cache:*' | xargs -r redis-cli DELSafely scan-delete matching keys without KEYS command
-
redis-cli SET mykey 'value' EX 3600Set key with 1-hour expiry (EX = seconds)