AccuralAI Cache Memory

In-memory cache implementations.

class accuralai_cache.memory.MemoryCacheOptions(*args: Any, **kwargs: Any)[source]

Bases: CacheConfig

Configuration options for in-memory cache behaviour.

eager_expiry: bool = True
class accuralai_cache.memory.MemoryCache(*, options: MemoryCacheOptions | None = None)[source]

Bases: BaseCache

LRU-style cache with TTL support.

__init__(*, options: MemoryCacheOptions | None = None) None[source]
async get(key: str, *, request: GenerateRequest) GenerateResponse | None[source]
async set(key: str, value: GenerateResponse, *, ttl_s: int | None = None) None[source]
async invalidate(key: str) None[source]
async invalidate_prefix(prefix: str) None[source]

Optional hook for derived caches; default routes to individual invalidation.

async accuralai_cache.memory.build_memory_cache(*, config: Mapping[str, Any] | Any | None = None, **_: Any) MemoryCache[source]

Factory for registering the advanced memory cache.

accuralai_cache.memory.AdvancedMemoryCache

alias of MemoryCache

accuralai_cache.memory.CacheOptions

alias of MemoryCacheOptions