Investigate why a cached value is stale or missing
Quando usar: A user says 'I updated my profile but it's still showing the old name' — likely a cache invalidation issue.
Pré-requisitos
- Redis URL with at least read access —
REDIS_URL=redis://:pw@host:6379/0
Fluxo
-
Find the right keyScan keys matching
user:profile:42*— show each with its type and TTL.✓ Copiado→ Matching keys list -
Inspect the stored value and expiryFor
user:profile:42, GET the value and show the TTL. Is it stale vs expected?✓ Copiado→ Value + TTL + verdict -
Bust it deliberatelyDelete that key (and any related list/set keys) so the app repopulates on next read. Confirm deletion.✓ Copiado→ DEL returned 1 or more
Resultado: A confirmed-fixed cache with a trail of what was stale and why.
Armadilhas
KEYS *on a big instance stalls the server — Always use SCAN (the server translatesscantools to non-blocking cursors); neverKEYS