Q20 Redis Domain 2 · 25–30% of exam Priority · Real Exam

A cached response must be invalidated when its underlying record changes. Which approach is most reliable?

  1. A Rely on TTL expiry alone
  2. B Explicitly DEL the cache key in the same code path that writes the record (correct answer)
  3. C Use Pub/Sub without subscribers
  4. D Reduce maxmemory

Shortcut: Write-through invalidation removes the stale entry deterministically at the moment of change. TTL alone leaves a stale window equal to the remaining TTL.