The cache that lied
transcript
The shop changes a price. It's now 320 rupees. But the app still says 300. Nothing crashed. Nothing complained. Nothing at all.
A caching proxy asks the price service once. The answer is 300. And it remembers. Then the shop changes the price to 320. The cache has no idea at all. The next ask is answered from memory. Still 300. And that's wrong. Only an invalidate makes it forget.
A caching proxy makes one promise: the answer hasn't changed. It answers four asks with one trip to the service. But the service can't push a change back. The proxy only learns if it's told.
So give every cache a rule. First choice: an expiry time, so it forgets by itself. Or an invalidate call, that the writer makes. Or both. Without one, it's stale for ever, and nobody notices.
Before you cache, decide when it forgets. A cache that never forgets is a bug.
Full breakdown in the lecture.