Documentation
¶
Overview ¶
Package gencache is keryx's content-addressed generation cache (R-GEN-8 / R-GLOBAL-9): a generated artefact set — a VO line's takes, a music bed, a card's illustrations — is keyed by a hash of its request (text/scene/prompt + all the settings that affect the output). Re-running a generation with unchanged inputs is a cache HIT: the takes are materialised from the cache with no provider call and no spend. The cache lives under the workspace's git-ignored, prune-able `.cache/` dir, keyed by kind + request hash, so it survives a text revert and never bloats the repo.
The cache stores the *set* of takes for a request (not per-blob), so generation variety (`--takes N`) is preserved — a hit replays the same N candidates.
Index ¶
Constants ¶
const CacheRoot = ".cache"
CacheRoot is the workspace-relative cache directory (git-ignored; pruned).
Variables ¶
This section is empty.
Functions ¶
func Key ¶
Key hashes the request's content-affecting fields into a stable hex digest. The fields are JSON-marshalled (deterministic order), so any change — text, a setting, the model, a pronunciation dictionary — yields a different key and thus a miss.
func Read ¶
Read returns the cached blob set for a key dir in take order (1, 2, …), or nil when the dir is absent/empty (a miss). Blobs are stored as plain numbered files.
func Write ¶
Write stores the blob set under the key dir as numbered files (1, 2, …). It writes the full set to a sibling temp dir first and only then swaps it into place, so a mid-write failure (disk full, cancel, crash) leaves the prior entry intact rather than a truncated one — Read never sees a partial set it would treat as a hit.
Types ¶
This section is empty.