zoomy_core.model.derivation.cache_keys

zoomy_core.model.derivation.cache_keys#

Content-addressed cache keys (SHA-256 of sympy srepr) for the derivation pipeline. Keys capture the full symbolic state of an operation or model, so a too-coarse key can only cause a miss, never a stale hit.

Module Contents#

Functions#

derivation_cache_enabled

Return whether derivation caching is on (env ZOOMY_DERIVATION_CACHE, default off). This is the single switch for every cache tier (derivation_cache, model cache, SystemModel cache).

op_key_content

Return the result-affecting content string of one derivation Operation.

cache_key

Return the SHA-256 hex key of an Operation, Equation or any value understood by _canonical, prefixed with CACHE_VERSION.

argument_key

Return the content key of a decorated function’s argument: spec key for a declarative model, cache_key for operations and equations, else canonical srepr.

model_spec_key

Return the key of a model’s derivation identity: class plus constructor params, without cosmetic and runtime-attached ones.

equations_key

Return the key of a model’s current equation residuals, order-independent over equation names.

op_sequence_key

Return the key of an ordered sequence of operations.

basis_key

Return the key of a concrete basis from its matrix-cache fingerprint.

Data#

API#

zoomy_core.model.derivation.cache_keys.derivation_cache_enabled() → bool#

Return whether derivation caching is on (env ZOOMY_DERIVATION_CACHE, default off). This is the single switch for every cache tier (derivation_cache, model cache, SystemModel cache).

zoomy_core.model.derivation.cache_keys.CACHE_VERSION#

‘v9’

zoomy_core.model.derivation.cache_keys.op_key_content(op) → str#

Return the result-affecting content string of one derivation Operation.

zoomy_core.model.derivation.cache_keys.cache_key(obj) → str#

Return the SHA-256 hex key of an Operation, Equation or any value understood by _canonical, prefixed with CACHE_VERSION.

zoomy_core.model.derivation.cache_keys.argument_key(obj) → str#

Return the content key of a decorated function’s argument: spec key for a declarative model, cache_key for operations and equations, else canonical srepr.

zoomy_core.model.derivation.cache_keys.model_spec_key(model, *, include_bc_ic=False) → str#

Return the key of a model’s derivation identity: class plus constructor params, without cosmetic and runtime-attached ones.

Args

  • include_bc_ic: Also fold the boundary/initial-condition params into the key.

zoomy_core.model.derivation.cache_keys.equations_key(model) → str#

Return the key of a model’s current equation residuals, order-independent over equation names.

zoomy_core.model.derivation.cache_keys.op_sequence_key(ops) → str#

Return the key of an ordered sequence of operations.

zoomy_core.model.derivation.cache_keys.basis_key(basis) → str#

Return the key of a concrete basis from its matrix-cache fingerprint.