caching-strategies
Installation
SKILL.md
Caching Strategies
Concept of the skill
A cache stores a copy of data closer to the consumer so repeated reads avoid the expensive recompute or refetch. The win is real — an expensive query becomes a fast lookup — but the copy creates a coherence problem: it can drift from the source of truth. Caching is the discipline of capturing the speed-and-load win while controlling the staleness it introduces.
Every caching decision is two coupled choices made for a specific layer:
- Staleness budget — how out-of-date may this data be? (A price quote: seconds. A user's avatar: hours. A blog post: minutes.)
- Invalidation strategy — how does the copy get corrected when the source changes? (Expiry, explicit invalidation, versioned keys, write-through.)
The two famously hard problems, per the field's oldest joke, are cache invalidation and naming things — and caching forces you to confront the first one directly.