# Caching

URL: https://tnb-tech.com/en/glossary/caching/

## What is caching?

Caching is keeping a ready-made copy of a page or file so it does not have to be rebuilt or downloaded again on every visit. The server keeps finished pages, the visitor’s browser keeps the images, styles and scripts it has already fetched, and a content delivery network (CDN) can hold copies close to the visitor. A well-set cache cuts the time to first byte and the load on the hosting.

**Example**

A WooCommerce shop rebuilds every category page from scratch: PHP, database queries, the template — about 1.2 seconds of server work per visit. At 10,000 visits a day that is 10,000 × 1.2 = 12,000 seconds, more than three hours of pure server time every day. With page caching, the finished copy goes out in about 0.05 s: 10,000 × 0.05 = 500 seconds, under nine minutes. The same hosting now copes with the Friday-evening peak, and visitors see the page sooner.

Text compression sits next to caching. The server squeezes HTML, CSS and JavaScript with Gzip or Brotli before sending them, and they typically shrink several times over. It is often a single hosting setting that nobody switched on.

**Why it matters for a business**

Caching is the cheapest way to let a site carry more visitors without changing the hosting. It has limits, though. The basket, the checkout, the account area and customer-specific prices are never cached, or one customer could see another’s details. With dynamic content, the shared parts are cached and the personal ones load separately. Caching is also the usual reason behind “I changed the text, but the site still shows the old one”: the copy has to be cleared on every change, automatically, not by emailing the developer.

**What to ask**

- What is cached — pages, database queries, files in the browser — and for how long?
- Which pages are excluded from the cache, and why?
- Is the cache cleared automatically when a product, a price or a stock level changes?
- Is text compression switched on at the server?
- Is a CDN worth it, or are your visitors in the same country as the server?We set up caching and compression as part of our website speed optimisation. Both are worth rechecking after every update, because a single plugin update can quietly switch them off.

- Services: [Website speed optimisation](https://tnb-tech.com/en/services/website-speed-optimisation/)
- Glossary: https://tnb-tech.com/en/glossary/
