jellycell.cache.function_cache

Function-level memoization backed by :class:CacheStore.

Wires @jc.cache to the same content-addressed store that backs cell caching. The key combines the function’s qualified name, its source text (stripped by the same normalization as cell source), and a pickle hash of the call arguments.

Limitations (documented + accepted for v0):

  • Arguments must be pickle-able. Non-picklable inputs (open file handles, lambdas, bound methods with non-picklable self) raise at call time.

  • Source changes invalidate every call — same principle as cell hashing.

  • Concurrent calls from the same process race on write (diskcache is atomic per-key; last-writer wins).

The decorator is transparent in standalone mode (no RunContext) — it just calls the function.

Module Contents

Functions

cache_function

Memoize fn via the current run’s CacheStore.

Data

F

API

jellycell.cache.function_cache.F

‘TypeVar(…)’

jellycell.cache.function_cache.cache_function(fn: jellycell.cache.function_cache.F) jellycell.cache.function_cache.F

Memoize fn via the current run’s CacheStore.

Identity operation outside a run (get_context() returns None) so the same decorator works in notebooks and in standalone scripts.