ahvn.klstore.cache_store module

class ahvn.klstore.cache_store.CacheKLStore(cache, name=None, condition=None, *args, **kwargs)[源代码]

基类:BaseKLStore

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

参数:
  • cache (BaseCache) -- The cache backend to use for storing BaseUKF objects.

  • name (str)

  • condition (Callable | None)

__init__(cache, name=None, condition=None, *args, **kwargs)[源代码]

Initialize CacheKLStore with a BaseCache instance.

参数:
  • 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()[源代码]

Close the cache of the store.

flush(**kwargs)[源代码]

Flush the cache of the store.