HTTP cache
A store that keeps HTTP responses and reuses them for later requests, following the rules the server sends in Cache-Control.
In more detail
A private cache belongs to one user, such as a browser. A shared cache, such as a proxy or content delivery network, serves many users, so it must never reuse a personal or credentialed answer for someone else. Caches key stored answers by method and address, plus any request headers named in Vary.
Example
In the browser: The server's headers decide how long a response stays fresh and when it must be revalidated. A service worker's Cache Storage is separate and fully controlled by your code.Related terms
- cache — A store of earlier answers kept close to where they are needed so they can be reused instead of fetched or computed again.
- Cache-Control — The HTTP header that states the caching policy for a response, such as private, max-age=0 or no-store.
- freshness — Whether a cached response may still be used without asking the server: fresh means yes, stale means it must be checked or fetched again.
- Vary header — The response header that lists which request headers changed the answer, so caches keep separate copies for each value.
- ETag — A response header holding an opaque tag that names one exact version of a representation, such as ETag: "1".
- Cache Storage API — A browser storage API that saves pairs of Request and Response objects in named caches, usually managed by a service worker.
- Request Memoization — The first Next.js caching tier: identical fetch calls made while rendering one request are run only once.
- Data Cache — The second Next.js caching tier: a server-side store of fetch results that persists across requests, users and deployments.
- Full Route Cache — The third Next.js caching tier: the server stores the rendered HTML and RSC payload of static routes and serves them without re-rendering.
- Router Cache — The fourth Next.js caching tier: the browser keeps RSC payloads of visited and prefetched route segments in memory for instant navigation.
Taught in
- Headers And Content Negotiation — Modern API Architecture: REST, GraphQL & gRPC
- Caching And Conditional Requests — Modern API Architecture: REST, GraphQL & gRPC
- Partial Responses — Modern API Architecture: REST, GraphQL & gRPC
- When Each Wins: REST, GraphQL, gRPC And SOAP — Modern API Architecture: REST, GraphQL & gRPC
- Cache Storage API: Offline Strategies And Cache-First Patterns — Frontend Architecture & Web Platform
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform
- Data Cache: Cross-Request Persistence & Fetch Tags — Next.js 15 & Modern App Router Architecture
- Router Cache: In-Memory Client Prefetch Semantics — Next.js 15 & Modern App Router Architecture
- Revalidation Strategies: revalidatePath & Cache Life — Next.js 15 & Modern App Router Architecture
- Route Handlers: RESTful Endpoints with NextRequest — Next.js 15 & Modern App Router Architecture
- Edge Middleware: Auth Verification & Route Matchers — Next.js 15 & Modern App Router Architecture
- Metadata API: Dynamic OpenGraph & Head Management — Next.js 15 & Modern App Router Architecture