Skip to content

Cache Invalidation Problem

Determining when cached data is stale is fundamentally difficult because it requires knowledge of external state changes; incorrect invalidation causes either stale reads or unnecessary recomputation

Tension Addressed

Correctness vs. Speed

Recognizable As

TTL expiration, cache-aside pattern, write-through/write-behind strategies, versioned keys, pub/sub invalidation

Canonical Sources

Phil Karlton's "two hard things in computer science" observation; Helland, "Immutability Changes Everything" (2015)

Transfers To

Distributed systems consistency, materialized view maintenance, derived data freshness

The aphorism "There are only two hard things in computer science: cache invalidation and naming things" captures that cache invalidation is not merely difficult but fundamentally hard - requiring solving the distributed consensus problem in many cases.

Sub-concepts: - Cache Stampede: When many requests simultaneously miss cache and overwhelm the origin - Write-Through vs. Write-Behind: Trade-off between consistency guarantees and write latency