Cache Invalidation — Choosing a Strategy#
"There are only two hard things in computer science: cache invalidation and naming things." The reason it's hard: the cache doesn't automatically know when the DB changes. You have to tell it — or wait for time to expire it. Every strategy is a different trade-off between freshness, complexity, and performance.