zoomy_core.systemmodel.sm_cache

zoomy_core.systemmodel.sm_cache#

Cache of built SystemModel objects (memory, user directory, shipped _prebuilt), keyed on the model spec and the source of every class in its MRO; a model whose source cannot be read is never cached. Off by default; ZOOMY_DERIVATION_CACHE=1 enables it and ZOOMY_DERIVATION_REBUILD=1 rebuilds.

Module Contents#

Functions#

cache_key

Cache key of the built SystemModel of model (spec, MRO sources, builder source), or None if uncacheable. BCs and ICs are runtime data and are not part of the key.

fetch

A fresh SystemModel unpickled for key, or None on a miss, disabled cache or key is None.

store

Persist sm under key in memory and the user directory; a no-op for key is None or a disabled cache.

API#

zoomy_core.systemmodel.sm_cache.cache_key(model, builder) → str | None#

Cache key of the built SystemModel of model (spec, MRO sources, builder source), or None if uncacheable. BCs and ICs are runtime data and are not part of the key.

zoomy_core.systemmodel.sm_cache.fetch(key: str | None)#

A fresh SystemModel unpickled for key, or None on a miss, disabled cache or key is None.

zoomy_core.systemmodel.sm_cache.store(key: str | None, sm) → None#

Persist sm under key in memory and the user directory; a no-op for key is None or a disabled cache.