neu_draw.cache

Caching for sources reads, which take seconds each from an object store.

A Cache is anything with in, [] and []=, so a plain dict works. MemoryCache is the in-memory default and Yes3Cache a persistent one.

Classes

Cache

key in cache, cache[key], cache[key] = value.

MemoryCache

A dict, named for readability at the call site.

NullCache

Caches nothing. The explicit way to turn caching off.

Yes3Cache

Adapter for a yes3 path-backed cache, so results survive a kernel restart

Functions

resolve(cache[, default]) → Cache

Normalise the cache= argument every source function takes.

Module Contents

class neu_draw.cache.Cache

Bases: Protocol

key in cache, cache[key], cache[key] = value.

class neu_draw.cache.MemoryCache

Bases: dict

A dict, named for readability at the call site.

Initialize self. See help(type(self)) for accurate signature.

class neu_draw.cache.NullCache

Caches nothing. The explicit way to turn caching off.

class neu_draw.cache.Yes3Cache(location: Any)

Adapter for a yes3 path-backed cache, so results survive a kernel restart (needs the cache extra).

neu_draw.cache.resolve(cache: Cache | str | Any | None, default: Cache | None = None) → Cache

Normalise the cache= argument every source function takes.

None means default (or no caching); False means explicitly none; a path means a yes3 cache there; anything with the three methods is used as-is.