What is a cache?
A cache avoids repeating work: transferring the same stylesheet, rendering an unchanged page or calculating the same result. HTTP caching concerns stored HTTP responses; an application cache can instead hold objects or database-query results. These layers can coexist, but a response does not necessarily pass through every possible cache.
What caching can improve
A reusable response can avoid a network transfer or reduce work at the origin. That can improve delivery performance, but a cache miss still needs a response from upstream. Caching alone establishes no speed percentage, conversion lift or ranking result. Google describes Core Web Vitals as measures of loading, interactivity and visual stability; measure the affected experience rather than treating a cache setting as a score.
Freshness and validation
A fresh stored response can be reused subject to its cache rules. When validation is required, the client can send a conditional request using an ETag or Last-Modified value. An unchanged resource can produce HTTP 304 Not Modified, allowing reuse of the stored body; a changed resource needs an updated response.
Browser caches and shared caches
A private cache is dedicated to a user, commonly inside a browser. Shared caches include reverse proxies and CDN caches. The distinction matters for personalized responses: a cookie by itself does not make a response private. Specify the policy and check the managed cache’s configuration.
Illustrative response policies
These headers describe hypothetical responses, not this website’s deployed configuration. The numbers are policy choices for the examples, not recommended durations for every site.
Cache-Control: public, max-age=300, s-maxage=600
Cache-Control: private, no-cache
Cache-Control: no-storeIn the first example, max-age allows a freshness lifetime of 300 seconds; s-maxage sets 600 seconds for shared caches and overrides max-age there. The second allows private storage but requires validation before reuse. The third tells HTTP caches not to store the response. Managed-cache overrides still need review.
Cache and CDN describe different things
Caching is a storage-and-reuse mechanism. A content delivery network is delivery infrastructure that can include geographically distributed shared caches. A browser cache is not a CDN; adding a CDN also does not replace application-level caching or make every response cacheable.
Choose a policy for each response
| Directive | Meaning | Decision to check |
|---|---|---|
private | Unqualified directive restricts storage to private caches. | Is this response intended for one user? |
no-cache | Storage is allowed; validation is required before reuse. | Must a stored copy be checked before serving it? |
no-store | Do not store the response in an HTTP cache. | Would retaining this response be inappropriate? |
max-age / s-maxage | Set freshness lifetimes; s-maxage applies to shared caches. | How long may each layer reuse this response? |
Use changed filenames for changed static assets when employing long-lived caching. For HTML that must reflect updates promptly, choose a validation or invalidation strategy that you can actually test.
Test stale content and response variants
Do not assume missing Cache-Control means nothing will be cached: HTTP permits heuristic caching in some circumstances. Check Vary and the cache key when language, encoding or other request properties affect the response. A cache key must not let one visitor retrieve another visitor’s personalized data.
Review the publishing path
After a content update, compare the origin response with the version served through each cache. Inspect response headers, request the resource again, and confirm that readers receive the intended content. Clearing one CDN cache does not clear every browser cache. Record the layer responsible for invalidation rather than assuming a publishing tool handles it.
Questions about cache
Does no-cache disable caching?
No-cache permits a stored response, but requires successful validation before it is reused. No-store is the directive that prohibits HTTP-cache storage.
How do I clear a cache?
Use the controls for the layer that holds the response: a browser control, a managed-cache purge, or an application-specific invalidation operation. Clearing one layer does not establish that every other stored copy has been removed.
What is a good cache hit ratio?
There is no target established by this definition. Assess the ratio for the specific request set and check freshness and privacy as well as reuse. A high hit ratio is unhelpful if the stored responses are wrong.
Related terms
Core Web Vitals · Content Delivery Network (CDN) · Time to First Byte · Page Speed