caching

Installation
SKILL.md

Skill: Caching

Cache tech from memory-long §stack. A cache is deliberately serving stale data for speed — every decision below is about controlling how wrong you're willing to be.

Before caching anything

  1. Prove the problem: measure first — cache added without a measured hot path is complexity without evidence (see performance-cwv for the front-side counterpart).
  2. Answer in writing (report/ADR): what's the acceptable staleness? What invalidates it? What happens on a miss storm? No answers = no cache.

Invalidation (the famous hard problem)

  • TTL is the safety net, not the strategy — every entry has one (nothing cached forever), but correctness comes from explicit invalidation on write paths.
  • Invalidate by key discipline: keys are structured and enumerable (user:{id}:orders), so write paths can target them — regex-sweeping a cache is a smell.
  • Never cache-then-write: update source of truth first, then invalidate (not update) the cache — deleting is idempotent, rewriting races.

Stampede protection

Popular key expires → N requests hit the source simultaneously. Pick one: request coalescing/locking (one refills, others wait) · probabilistic early refresh · stale-while-revalidate. Default: SWR where user-facing, locking where the source is fragile.

Installs
1
GitHub Stars
6
First Seen
Nov 6, 2026