Living note

Choosing Cache Boundaries

How to decide what belongs in browser, edge, application, or data-layer caches.

A cache is a consistency decision with a performance benefit, not merely a faster key-value lookup.

Boundary checklist

Cache boundary trade-offs
LayerBest forMain risk
BrowserPrivate, reusable assetsHard invalidation
EdgeShared public responsesRegional drift
ApplicationComputed domain dataMemory pressure

Name the invalidation event

If the team cannot name what invalidates a value, the cache policy is unfinished.
cache-policy.tsTS
export const articleCache = {
  key: (slug: string) => `article:${slug}`,
  revalidateOn: ["article.published", "article.unpublished"],
  ttlSeconds: 300,
};