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
| Layer | Best for | Main risk |
|---|---|---|
| Browser | Private, reusable assets | Hard invalidation |
| Edge | Shared public responses | Regional drift |
| Application | Computed domain data | Memory pressure |
Name the invalidation event
If the team cannot name what invalidates a value, the cache policy is unfinished.
export const articleCache = {
key: (slug: string) => `article:${slug}`,
revalidateOn: ["article.published", "article.unpublished"],
ttlSeconds: 300,
};