FamilyHQ Sign out Sign in

Cache management

How lazysite caches pages and how to control regeneration.

Cache management

lazysite caches rendered pages as .html files alongside their .md sources. The cache is transparent - Apache's DirectoryIndex serves the .html file directly without invoking the processor.

When cache is served

A cached .html file is served when:

Cache is skipped when:

When cache is written

After processing a page, the rendered HTML is written to the corresponding .html path. Cache writes are skipped when:

Forcing regeneration

Delete the cached .html file:

rm public_html/my-page.html

The next request to /my-page regenerates and caches it.

Clear all cached pages:

find public_html -name "*.html" ! -path "*/lazysite/*" -delete

Page TTL

Set ttl: in front matter to keep serving the cache even when the .md source is newer:

---
ttl: 300
---

The TTL is in seconds. This is useful for pages with url: or scan: variables that should not regenerate on every source file touch.

Browser caching

When a page has ttl: set, the processor sends a Cache-Control: public, max-age=TTL HTTP header. This tells the browser to cache the response for that duration without revalidating.

Pages without ttl: do not send a Cache-Control header - browser behaviour depends on its defaults.

When LAZYSITE_NOCACHE is set, the Cache-Control header is still sent if the page has ttl: - NOCACHE only affects the server-side .html cache, not browser cache headers.

Notes