qldpc.cache

Helper function(s) for caching results.

Attributes

Params

Functions

clear_entry(→ None)

Clear an entry from a local cache.

get_disk_cache(→ diskcache.Cache)

Retrieve a dictionary-like cache object.

get_disk_cache_path(→ pathlib.Path)

Retrieve the path of a cache.

running_with_pytest(→ bool)

Are we currently running with pytest?

use_disk_cache(...)

Decorator to cache results to disk.

Module Contents

qldpc.cache.clear_entry(cache_name: str, key: collections.abc.Hashable, *, cache_dir: pathlib.Path | str | None = None) → None[source]

Clear an entry from a local cache.

qldpc.cache.get_disk_cache(cache_name: str, *, cache_dir: pathlib.Path | str | None = None) → diskcache.Cache[source]

Retrieve a dictionary-like cache object.

qldpc.cache.get_disk_cache_path(cache_name: str, *, cache_dir: pathlib.Path | str | None = None) → pathlib.Path[source]

Retrieve the path of a cache.

qldpc.cache.running_with_pytest() → bool[source]

Are we currently running with pytest?

qldpc.cache.use_disk_cache(cache_name: str, *, cache_dir: pathlib.Path | str | None = None, key_func: collections.abc.Callable[..., collections.abc.Hashable] | None = None) → collections.abc.Callable[[collections.abc.Callable[Params, Any]], collections.abc.Callable[Params, Any]][source]

Decorator to cache results to disk.

qldpc.cache.Params