Cache Calculator (cache://)
The cache:// calculator does not run anything. It looks in one or more existing result
directories for a case whose input files hash identically to the current case and,
if it finds one with valid outputs, copies those results in — skipping the computation.
Put it first in a calculator list so real calculators only run on cache misses.
URI Syntax
calculators = "cache://previous_run"
calculators = ["cache://run1", "cache://archive/results"] # several caches
calculators = ["cache://archive/2024-*/results"] # glob patterns
calculators = [
"cache://previous_results", # try cache first
"sh://bash calculate.sh", # compute on miss
]
How It Works
- Compute the MD5 hash of every input file for the current case.
- Search the cache directories for a
.fz_hashfile whose entries all match. - Check that the cached outputs are non-
None. - On a hit, copy the cached result files in and mark the case
done; on a miss, fall through to the next calculator.
Matching is by .fz_hash content, not directory name — so a cache written with any
case_naming scheme
(path / hash / index) still matches.
Note
The cache keys on input files only, not on the calculator command. Editing your
calculation script but not the inputs will still produce a cache hit — use a fresh
results_dir without cache:// to force recomputation.
Common Uses
See Also
- Caching Strategy — deeper patterns
- Interrupt Handling
fzdcross-iteration caching