Cachingpurgecache busting
Cache invalidation
Definition
Cache invalidation is the act of marking cached entries as invalid, by deleting, overwriting or versioning them, when the underlying data changes.
In practice
TTL alone bounds staleness; explicit invalidation shortens it to near zero for data that must be fresh. The usual approach after a write is to update the database and then delete the cache key, letting the next read repopulate it.
Races are the classic pitfall: a slow reader can write an old value back into the cache after the invalidation. Short TTLs as a safety net, versioned keys and invalidation driven by change events reduce the window.
Example
After a price update commits, the service deletes product:42; the next read misses, loads the new price and caches it.