GARDEN NOTEMarch 2024

Why caching finally clicked for me

A mental model shift from 'storing data' to 'managing state latency'.

For a long time, I thought about caching simply as “saving a copy of something so it’s faster to get next time.”

While technically true, that mental model didn’t help me understand where to put caches in a distributed system, or how they fail.

What finally clicked was thinking about caching not as storage, but as managing state latency boundaries.

Every piece of data has a source of truth. The moment data leaves that source, it becomes stale. A cache is just an explicit, engineered acceptance of that staleness in exchange for speed.

Once I started thinking about it as an agreement (“I agree to accept data that might be up to X seconds old”), cache invalidation stopped feeling like a terrifying puzzle and started feeling like a predictable contract.