What “clear Redis cache” means
Redis is often used as a shared object cache, session store, rate limiter, or job queue backend. Clearing “cache” might mean dropping one logical database index, deleting keys with a prefix, or nuking the entire instance—those differ wildly in blast radius. Always know which SELECT index or cluster shard your app uses before typing destructive commands.
Commands and tradeoffs
| Command | Scope | Risk |
|---|---|---|
FLUSHDB | Current logical DB on one node | Still wipes every key in that DB |
FLUSHALL | All DBs on one node | Disastrous on shared managed Redis |
SCAN + UNLINK/DEL | Pattern delete | Slower but targeted |
Replication and cluster
Writes replicate to replicas—flushing a primary drops data readers expect. In Redis Cluster, each primary owns slots; you must script operations per primary or use admin tools that understand slot maps.
Eviction vs explicit delete
When maxmemory is hit, maxmemory-policy may evict keys you thought were “cache”—monitor hit rates and TTLs so eviction is not confused with application bugs.
Related: Clear WordPress cache (object cache), Clear Docker cache, Linux disk usage.