Web & CMS

What is Caching

What it is

Keeping a ready result so the same work is not done twice: the browser does not download styles and fonts again, the server does not rebuild the same page. The site opens faster and the server handles more visitors.

How we use it

On Valery Afanasyev's business-card site styles, scripts and fonts are cached for a year, while the page, robots.txt and the sitemap are always checked with the server, so edits show up at once. The online store has a separate Redis cache.

Where it helps a business

  • The site opens slowly, especially on repeat visits.
  • On sale days the server cannot cope with the traffic.
  • Edits do not show up at once: some people still see the old version.

How we use it

  • Different rules for different files. On Valery Afanasyev's site styles, scripts and fonts are cached for a year and carry a version tag, so after an edit the browser downloads the new file. The page, robots.txt and the sitemap are always checked with the server.
  • A separate data cache. In the online store frequently used data and sessions live in Redis instead of being read from the database every time.

Common problems

  • A whole page cached. A shopper sees someone else's cart or yesterday's prices.
  • No version tag on files. After an update the site looks broken for some visitors until the cache expires.
  • Caching instead of fixing. A slow database query is only hidden until the first cache miss.

When you do not need it

A small site with few visitors needs no complex data cache. Proper cache headers for styles and images are always worth it, though: they cost nothing.

โ† All terms

Need a website, a bot or automation?

Terms explained โ€” now let's get to work: tell us about the task and we'll turn it into a clear work plan.