---
"@type": Article
"@id": "https://helloloam.dev/principles/speed-by-caching"
"@source": "https://helloloam.dev/data/article/speed-by-caching.json"
"@stamp": "2026-10-22T21:53:55+00:00"
about:
  "@type": DefinedTerm
  "@id": "https://helloloam.dev/data/definedterm/speed-by-caching.json"
  name: Speed by caching
  identifier: speed-by-caching
  inDefinedTermSet:
    "@type": DefinedTermSet
    "@id": "https://helloloam.dev/data/definedtermset/mechanics.json"
    name: Mechanics
    identifier: mechanics
author: {"@id":"https://helloloam.dev/#organization"}
datePublished: "2026-10-03"
description: Pages render from the files when they are asked for, and the result is kept until a file beneath it changes. Fast, without a second copy of the truth.
headline: Speed by caching
identifier: speed-by-caching
inLanguage: en
publisher: {"@id":"https://helloloam.dev/#organization"}
url: "https://helloloam.dev/principles/speed-by-caching"
---

# Speed by caching

## No build step

A page is produced when it is requested, from the files as they are at that moment: the entity is read, its references resolved, the template applied. Static-site generators rebuild everything on every change; compiled systems bake a graph on publish. Both buy fast reads with a second copy of the truth — one that can be stale, half-built or out of step.

## One copy, a cache on top

Loam keeps one copy, and caches what it derives from it. A rendered page is kept and served again until something beneath it changes; a publish clears it at once. A cache is disposable and never consulted for truth: throw it away and the first request builds it again, the same.

## Freshness is a look, not a search

A change marks its folder and every folder above it. Whether a cache is still good is one glance at a timestamp — never a walk through the site. Even a file changed outside the usual way is noticed within seconds.

## Small things that stay fast

- **Indexes in memory.** The site's indexes are stored as compiled code that PHP keeps in shared memory, so loading one costs next to nothing.
- **Assets for a year.** Every image, stylesheet and script carries its own version string. Browsers and CDNs keep them for a year; change the file and only that file is fetched again.
- **Publishing is a move.** Going live moves a file [from the draft layer to the live one](/principles/draft-and-live-lifecycle), in the time it takes to rename. The next request renders the new state.

## No cascade

A compiled system must recompute everything that embeds a changed entity — work that grows with the site and fails when interrupted. In loam a person's name changes in one file, and every page that mentions them shows it on the next request. Nothing to recompute, nothing to interrupt.

## What it costs

Work per request instead of per change: a few file reads and a template whenever a page is not in the cache. For hundreds of pages and a change a day, that is milliseconds. And because every page carries [a fresh security nonce](/principles/security-bolted-in), HTML is not cached at the edge — each page view reaches the server, where the render cache answers it. Millions of pages and a change a second would want a different trade.
