utils.caching
utils.caching
Functions
| Name | Description |
|---|---|
| cache | Caching decorator - a local authoring convenience, use with care! |
| clear_all_cache | Clear all caches in the current cache root. |
| clear_experiment_cache | Clear the cache for the current experiment / notebook. |
| set_cache_path | Set the path where the cache is stored, relative to the cache root which lies next to this file in /cache. |
cache
utils.caching.cache(fname='', redo=False)Caching decorator - a local authoring convenience, use with care!
On the first call the decorated function runs and its return value is pickled to {fname}.pkl under cache_path; later calls load the pickle instead of recomputing.
The cache is meant to speed up local iteration, not to be a durable artifact: the pickles store live JAX/equinox objects and can go stale across library upgrades. To stay robust the loader recomputes (instead of crashing) whenever the pickle fails to load or its environment stamp (jax/tvboptim version, function source) no longer matches. For committed docs, prefer Quarto’s freeze over relying on these pickles.
fname: name of the file where the computation is stored undercache_pathredo: if True, the computation is run even if the file already exists
clear_all_cache
utils.caching.clear_all_cache()Clear all caches in the current cache root.
clear_experiment_cache
utils.caching.clear_experiment_cache()Clear the cache for the current experiment / notebook.
set_cache_path
utils.caching.set_cache_path(experiment='')Set the path where the cache is stored, relative to the cache root which lies next to this file in /cache.
experiment: name of the experiment / notebook -> becomes a subdirectory in the cache root