CacheSession

CacheSession(
    cache=True,
    *,
    model=None,
    policy=None,
    namespace='',
    model_key=None,
    sampler_key=None,
)

Compute identity and check a cache before beginning costly sampling.

Reuse the returned CacheLookup with :meth:store after sampling completes. This API lets a remote caller avoid provisioning a container on a hit.

Methods

Name Description
lookup Return a hit, a storable miss, or a safe uncacheable miss.
store Publish only if graph and result still match the preflight identity.

lookup

CacheSession.lookup(
    sample_kwargs,
    *,
    operation='sample',
    overwrite=False,
    versions=None,
    sampler_identity=None,
)

Return a hit, a storable miss, or a safe uncacheable miss.

store

CacheSession.store(lookup, idata, *, status='complete', effective_sampler=None)

Publish only if graph and result still match the preflight identity.

A reported sampler fallback is not stored under the preflight key; callers must preflight a new identity if they want to cache that result.