Investigate why a cached value is stale or missing
Когда использовать: A user says 'I updated my profile but it's still showing the old name' — likely a cache invalidation issue.
Предварительные требования
- Redis URL with at least read access —
REDIS_URL=redis://:pw@host:6379/0
Поток
-
Find the right keyScan keys matching
user:profile:42*— show each with its type and TTL.✓ Скопировано→ Matching keys list -
Inspect the stored value and expiryFor
user:profile:42, GET the value and show the TTL. Is it stale vs expected?✓ Скопировано→ Value + TTL + verdict -
Bust it deliberatelyDelete that key (and any related list/set keys) so the app repopulates on next read. Confirm deletion.✓ Скопировано→ DEL returned 1 or more
Итог: A confirmed-fixed cache with a trail of what was stale and why.
Подводные камни
KEYS *on a big instance stalls the server — Always use SCAN (the server translatesscantools to non-blocking cursors); neverKEYS