Skip to the content
Start free

Caching

Caching is keeping a saved copy of a file or page so the next request can be answered from that copy instead of building or downloading it again. A browser, a CDN, a proxy or the server itself can hold the copy. Done well, it makes pages load faster and cuts server load. Done badly, it shows people old prices or someone else’s basket.

What is caching? #

Every time a visitor opens a page, the server may run code, query a database and send files such as images, CSS and scripts. Caching saves the result so the work is not repeated. HTTP has its own rulebook for this, RFC 9111, HTTP Caching, published in June 2022. It replaced the older RFC 7234 and sets out how caches store responses, how long they stay fresh and how they are checked again.

Where can a copy be kept? #

  • Private cache. RFC 9111 says a private cache serves a single user, often inside the browser. MDN’s guide to HTTP caching calls it a cache tied to one client.
  • Shared cache. Stores responses for reuse by more than one user. Proxies, reverse proxies and CDNs are shared caches. The copy held at the network edge is called an edge cache.
  • Server caches. A full page cache saves finished HTML. An object cache saves database results so code runs faster. These sit on or near the origin server.

Speed is part of page speed and Core Web Vitals. A cached page sends its first byte sooner, which helps time to first byte and Largest Contentful Paint. It also helps crawlers. In December 2024 Google wrote on its Search Central blog that its crawlers support HTTP caching using ETag with If-None-Match, or Last-Modified with If-Modified-Since. When nothing has changed, the server can answer 304 with no body, which saves compute and bandwidth. Google said it prefers ETag because it is less prone to errors, and suggests setting both. Fewer wasted fetches leave more crawl budget for pages that did change.

Why does it matter for AI answers? #

AI bots fetch the same files as search bots, and some fetch a lot. A good cache means an AI crawler burst is served from saved copies, so real customers do not feel it. Our guide will AI crawlers slow my website? covers this. Caching has a downside for AI too: if a stale copy of your price or stock is what the bot reads, the stale fact can end up in an answer. Short cache times on pages with changing facts reduce that risk.

How does it work? #

The server sends headers with each response that tell caches what to do. The main one is Cache-Control.

Header or value What it means
max-age=604800 The copy is fresh for 604,800 seconds, one week. After that it is stale.
no-cache May be stored, but must be checked with the server before each reuse.
no-store Must not be stored in any cache at all.
private Only the browser may store it, not a shared cache.
public, max-age=31536000, immutable Keep for a year and never recheck. For files whose name changes when the content changes.
ETag / Last-Modified Labels that let a cache ask “has this changed?” and get a short 304 reply.
Vary Tells caches to keep separate copies, for example per language.

MDN notes a trap: no-cache does not mean “do not cache”. It means “check first”. MDN also says that if a response has no Cache-Control header, a cache may still store it and guess a lifetime, which RFC 9111 suggests could be about 10% of the time since the file last changed. That guess is why MDN advises that basically all responses should state a Cache-Control header.

How do you update a file that is cached for a year? #

You change its address. MDN calls it common practice to change the URL each time the content changes, for example style.v124.css or bundle.js?v=124. The new name is a new file to every cache, so visitors get it at once. The HTML page itself cannot be renamed like that, so MDN suggests HTML usually uses no-cache. When you need everything refreshed now, a cache purge clears saved copies.

Common mistakes #

  • Caching personal pages in a shared cache. Basket, account and checkout pages must be private or not cached. MDN warns that a cookie alone does not make a response private.
  • Long cache on HTML with prices. Shoppers and bots see yesterday’s price.
  • Long cache on files that keep their name. A changed stylesheet does not reach visitors until the old copy expires.
  • Using no-store everywhere. MDN says you then lose benefits such as the back and forward cache.
  • Vary: User-Agent. MDN advises against it, because user agent strings vary so much that the cache barely works.
  • Caching an error. A short outage saved as a cached 5xx or a broken page keeps failing after the server is fixed.

A worked example #

A small online shop sets these rules:

File Rule Why
logo.v3.png, app.v58.js public, max-age=31536000, immutable Name changes with each release
Product pages Edge copy for 5 minutes, ETag set Fast, but price changes show within minutes
Basket and checkout private, no-cache Personal data must never be shared
robots.txt, sitemap Short cache, ETag set Bots get quick 304 replies when unchanged

When the price of one product drops, the shop purges that page so the new price shows at once.

How to check it #

  1. Read the Cache-Control, ETag and Age headers on any address with our HTTP Header Checker. The guide how to use the HTTP Header Checker explains each line.
  2. Our Cache Checker shows whether a page is served from a cache and for how long.
  3. Our Page Speed Checker (coming soon) will time each load, next to the Core Web Vitals Checker (coming soon).
  4. Make sure redirects are not cached in a loop with our Redirect Checker.
  5. Work out file sizes with Data Size Converter, and shrink images with the Image Compressor so less needs caching.
  6. In URSY Pro, opening in stages, the Edge cache report and Cached page visitors show how much traffic your cache absorbs.

Questions #

Does caching help SEO? #

Indirectly. It makes pages faster and lets crawlers skip unchanged files, which helps the technical SEO base. It is not a ranking factor on its own.

Can caching break my analytics? #

It can if your counter runs on the server. A page served from a cache never reaches your server, so server counts look low. Script or edge counters avoid this. See why analytics numbers are low.

How long should I cache a page? #

Match the cache time to how often the facts change. Versioned files: a year. Pages with prices: minutes. Personal pages: not at all in shared caches.

What is the difference between a cache and a CDN? #

A CDN is a network of servers near visitors. Caching is what most of those servers do. You can cache without a CDN, in the browser or on the server.

What URSY.com counts #

A page served from a cache is still a real visit by a real reader. People are counted as page views by our cookie-free counter, and we keep human page views and verified bots apart. See how we count.

Sources #

Updated 24 November 2026 by URSY.com.

Cite this page: Caching. URSY. Updated 26 November 2026. https://ursy.com/wiki/caching/ · Section links

Tools for this

All 871 wiki entries, A to Z →