Build the mental model
Cache correctness needs more than a TTL. Use targeted deletion on entity updates, key versions for schema changes, and dependency mapping for list caches. A logical namespace version can switch traffic without deleting many keys immediately, while old keys disappear through expiry.
Connect it to a real scenario
When tutorial 42 changes, delete its detail key and affected category-list keys. Move from `v1` to `v2` when the payload schema changes. For bulk imports, increment `catalog:namespace-version` so new requests use a fresh namespace.
Try the working example
SET catalog:namespace-version 7
SET catalog:v7:tutorial:42 '{"title":"Redis"}' EX 300
DEL catalog:v7:tutorial:42
DEL catalog:v7:list:data:page:1
INCR catalog:namespace-versionYou can selectively invalidate entries or roll the whole catalog to a new namespace.5-minute try-it
Create a dependency table of cache keys invalidated when an author is renamed.
One important caution
Versioning without expiry leaves old namespaces consuming memory indefinitely.
Redis — Keyspace Notifications — Redis