SpaceStack
Menu
Glossary

What is caching? A plain-English explanation

Caching is storing a ready-made copy of something so you don't have to build it again — the single most effective trick for making software feel fast. Here is how it works and where it bites.

Published Jul 4, 2026 • Updated Jul 4, 2026

Stylized cyberpunk illustration used as the editorial avatar for Daniel P.
Tech Lead Senior Software Engineer · Oslo, Norway
Short definition

Caching is storing a copy of data or a computed result so future requests are served instantly instead of recomputed or refetched — the most common way to make software faster.

The short version

Caching is keeping a ready-made copy of something so you do not have to build it again. Computed a result once? Store it. Fetched a file once? Keep it nearby. The next request gets the copy instantly instead of doing all the work over.

It is the oldest trick in computing and still the most effective. Almost every “how did you make it so fast?” story I have been part of has caching somewhere in the answer.

The catch is the famous one: the hard part is not caching, it is knowing when the copy is stale. Get that wrong and you serve people yesterday’s data.

Where caching happens

Caching is not one thing — it happens in layers, from the user’s browser all the way to your database.

Layers of caching between user and database
Browser
The user's device reuses files it already downloaded.
CDN / edge
A nearby edge node serves a cached copy globally.
Server
Your app stores rendered pages or API responses.
Database
Hot query results are kept in memory (e.g. Redis).
A request can be answered at any of these layers. The earlier it is answered, the faster and cheaper it is.

Why it matters for a small team

Caching is how a small server behaves like a big one:

  • Speed. Cached responses are near-instant, which directly improves Core Web Vitals.
  • Scale. A cache absorbs traffic spikes your origin could never handle alone.
  • Cost. Every cached hit is work your server did not have to do — less compute, less bandwidth.
  • Resilience. Cached content can keep serving even if a backend is momentarily down.

Pair caching with a CDN and you get most of the web-performance win available to a small team, without rewriting your app.

The one hard part: invalidation

The reason caching is tricky is cache invalidation — deciding when a stored copy is no longer valid. The practical answer for most small teams is to make it a non-problem by design.

Cache without serving stale content
  1. 1
    Version static files
    Hash filenames (app.3f9a.js) so a change means a new URL.
  2. 2
    Cache versioned assets forever
    Since the URL changes on update, you can cache aggressively and safely.
  3. 3
    Short TTLs for HTML/APIs
    Cache dynamic responses briefly, or purge on change.
  4. 4
    Purge on deploy
    Clear or bump the cache when you ship, so users get the new version.

Common caching tools

Redis product screenshot
Redis logo
Redis
Best for: Server / database caching

The go-to in-memory data store for caching database queries, sessions and computed results at the server layer.

Open Redis
Cloudflare product screenshot
Cloudflare logo
Cloudflare
Best for: Edge / CDN caching

Edge caching that serves your static assets and pages from a global network, close to every user.

Open Cloudflare
Varnish product screenshot
Varnish logo
Varnish
Best for: Advanced HTTP caching

A powerful HTTP caching layer (reverse proxy) for teams that want fine-grained control over server-side page caching.

Open Varnish

Different layers, different tools. Confirm current pricing and hosting options before you commit.

FAQ

Is caching the same as a CDN?

No. Caching is the concept of storing a ready-made copy. A CDN is a global network that does that caching close to your users. A CDN is one place caching happens, but caching also lives in the browser, your server and your database.

What should I not cache?

Anything personalized or sensitive at a shared layer — a user’s logged-in dashboard, cart or account data should not be cached where another user could receive it. Cache those per-user or not at all.

How long should I cache things?

Version your static assets and cache them for a year. Cache HTML and API responses for seconds to minutes, or purge them when the underlying data changes. The profiling workflow shows how to decide.

Why is my site showing old content after an update?

Almost always a caching issue — the browser or CDN is serving a stale copy. Versioned filenames and a purge-on-deploy step fix this permanently.

Keep reading