Skip to main content

Module cache

Module cache 

Source
Expand description

What makes a revisit cost nothing.

Two caches with different jobs. The listing cache holds one directory’s entries with their attrs, which is what lets a request answer “does this exist, and is it the same version the browser already has?” without going near the remote. The body cache holds file contents keyed by identity rather than by path, so it cannot serve a stale page: a rebuilt file has a different mtime or size and therefore a different key.

Structs§

Cache

Constants§

DEFAULT_BODY_CAP
Bytes of file content held at once.
DEFAULT_TTL
How long a listing is trusted. Short, because a directory’s contents are exactly what changes when a site is rebuilt, and a stale listing turns a new file into a 404.

Functions§

etag
A validator the browser can send back.
etag_matches
Weak comparison per RFC 9110: the weakness marker is stripped from both sides, and * matches whatever the client holds.