Expand description
Content-addressed evaluation cache (file hash + lock hash → result). Content-addressed evaluation cache.
Maps (source_hash, lock_hash) pairs to previously evaluated results,
skipping redundant evaluation when inputs haven’t changed.
§Tier model (additive — every tier is optional, all may stack)
- In-memory (
HashMap) for the current session — instant lookups. Always present. - JSON file at
~/.cache/sui/eval-cache.json— survives across invocations. Optional; enabled bywith_persistent. - GraphStore (
sui-graph-store, redb + rkyv on a ZFS-friendly blob layout) — fleet-shared / cross-process tier. Optional; enabled bywith_graph_store. When set, the eval cache’s entries become first-class blobs inGraphKind::EvalCacheEntry, which means a peer with the same GraphStore root (e.g. viazfs send | zfs recvor a future substituter push) gets every cached eval for free. Lookup-order onget: memory → graph_store (warm on disk via mmap, hits sub-200 µs); on a hit from the graph_store tier the result is promoted into memory so the next same-process lookup is sub-microsecond.
All three tiers honor the same enabled flag (set by the CLI flag
that disables caching entirely) and the same key shape (CacheKey).
Adding a tier never removes an older one — with_all_tiers enables
all three at once; individual with_* constructors stack them
incrementally.
Only JSON-serializable values are cached (no lambdas, no thunks).
Structs§
- Cache
Key - Hash of a source file plus its transitive inputs (flake.lock).
- Cached
Value - A cached evaluation result.
- Eval
Cache - Content-addressed evaluation cache with optional persistence.
Functions§
- now_
timestamp - Return the current Unix timestamp (seconds since epoch).