Cache Invalidation
The process of removing outdated cached data so fresh content can be served.
Definition
Cache invalidation is the process of removing or marking cached data as stale when the underlying data changes. This ensures users see current information rather than outdated cached versions.
Invalidation strategies include time-based expiration (TTL), event-driven purging when content updates, and cache-busting techniques using unique URLs or version identifiers.
Why It Matters
"There are only two hard things in computer science: cache invalidation and naming things." Improper invalidation leads to users seeing stale data; excessive invalidation negates caching benefits.
Getting invalidation right is crucial for applications requiring both performance and freshness.
Examples in Practice
A CMS automatically purging CDN cache when editors publish content updates.
Using content hashes in asset filenames to ensure browsers fetch new versions after deployments.
Event-driven cache invalidation triggered by database changes to keep search results current.