Glossary

Cache

Also known as: caching, cache-control, stale-while-revalidate
TechInfrastructurePerformance

Definition

A copy of a result kept closer to the asker than the source — in the browser, at the edge, in the server’s memory — so the next identical request is answered without doing the work again; every cache is a bet that the answer has not changed, and the rules for when to stop believing it (TTL, ETag, invalidation) are the whole design

Three caches sit between a reader and this site’s content: the browser’s (Cache-Control, ETag → a 304), Cloudflare’s edge, and Nitro’s own — defineCachedEventHandler on the analytics routes and the feed, an hour with stale-while-revalidate, bypassed in dev so an edit shows on reload. The two hard problems are the two famous ones: naming things (the cache key — the feed keys on nothing but itself; a report keys on its site id so one site never answers for another) and invalidation (Nuxt Content caches its parse in .data/content/contents.sqlite, which is why a changed hook shows only after that file is deleted).

Tech

The fastest request is the one that never reaches the origin. The cost is a second question on every bug report: is it wrong, or is it stale?

Related Terms

  • a: Appearance
  • ?: Keyboard shortcuts