Extended Data Object Layers - dol-based tools
To install: pip install xdol
Wrap a costly function (a paid API, a slow render) so the first run records its result to disk and every later run replays it:
from xdol import memoize_calls
@memoize_calls(
store="tests/cassettes", mode="record"
) # default mode is replay-only: a miss raises
def slow_square(x):
return {"result": x * x}Stable keys (xdol.keys), text / JSON / binary / paired .json+.bin codecs, any MutableMapping as the store (a folder, S3), spend-safe replay by default. See misc/docs/persistent_memoizer.md.