MSNCodeSNIPPETS← msncode.dev
snippets/redis

Delete Keys by Pattern

Delete all keys matching a pattern

redisbashdeletepattern
BASH
redis-cli --scan --pattern 'session:*' | xargs redis-cli DEL

More redis snippets

Flush Current Database

Delete all keys in the current database

Increment a Counter

Atomically increment a value in Redis

List All Keys

Show all keys in the current Redis database

Set Key with Expiry

Set a Redis key with a time-to-live in seconds