Documentation
¶
Overview ¶
Package cache provides an opt-in on-disk cache for compiler outputs keyed by source content + compiler version. Phase A caches the diagnostics slice returned by `kukicha check` so unchanged trees re-check near-instantaneously.
Enablement is opt-in via the KUKICHA_CACHE environment variable (set to "1"). Location defaults to $XDG_CACHE_HOME/kukicha/v1/ and can be overridden via KUKICHA_CACHE_DIR.
Index ¶
Constants ¶
const FormatVersion = 1
FormatVersion bumps whenever the on-disk cache payload shape changes. Bumping it invalidates every existing cache entry on the next lookup.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a content-addressed disk cache. A zero or disabled Cache is safe to use; Get always misses and Put is a no-op.
func Open ¶
Open returns a Cache rooted at the user's cache dir (honoring KUKICHA_CACHE_DIR if set). If KUKICHA_CACHE is not "1" the returned Cache reports Enabled()==false and is a no-op for Get/Put.
func (*Cache) Get ¶
Get tries to load a cached value for key into out (which must be a JSON-unmarshallable pointer). Returns true on hit, false on miss. Stale/corrupt entries are treated as misses; callers should not infer correctness from the return value beyond "use out" vs "recompute".
func (*Cache) Key ¶
Key computes a deterministic cache key from sources + tag. sources maps file path to source bytes; paths are sorted before hashing so iteration order doesn't affect the result. The tag distinguishes callers with the same sources but different desired outputs (e.g. "check" vs "build").