ahvn.klstore.cache_store module¶

class ahvn.klstore.cache_store.CacheKLStore(cache, name=None, condition=None, *args, **kwargs)[source]¶

Bases: BaseKLStore

KLStore implementation backed by a BaseCache instance. Stores BaseUKF objects in the cache, using kl.id as the key.

Parameters:
  • cache (BaseCache) – The cache backend to use for storing BaseUKF objects.

  • name (str)

  • condition (Callable | None)

__init__(cache, name=None, condition=None, *args, **kwargs)[source]¶

Initialize CacheKLStore with a BaseCache instance.

Parameters:
  • cache (BaseCache) – The cache backend to use.

  • name (Optional[str]) – Name of the KLStore instance. If None, defaults to “default”.

  • condition (Optional[Callable]) – Optional upsert/insert condition to apply to the KLStore. KLs that do not satisfy the condition will be ignored. If None, all KLs are accepted.

  • *args – Additional positional arguments for BaseKLStore.

  • **kwargs – Additional keyword arguments for BaseKLStore.

close()[source]¶

Close the cache of the store.

flush(**kwargs)[source]¶

Flush the cache of the store.