ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class CacheManager(ICacheManager): (source)

Constructor: CacheManager(app)

View In Hierarchy

Resolve configured cache stores and reuse their repositories.

Method __init__ Initialize the manager and resolve the active cache configuration.
Method _buildBackend Instantiate and return the raw backend for name.
Method _buildDatabaseBackend Instantiate and return the database cache backend.
Async Method add Store value only if key is absent in the default store.
Async Method clear Remove all entries from the default store.
Async Method decrement Decrement the integer at key by amount in the default store.
Async Method delete Remove key from the default store.
Async Method get Retrieve the value for key from the default store.
Async Method getMany Retrieve multiple values from the default store.
Async Method has Check whether key exists and has not expired in the default store.
Async Method increment Increment the integer at key by amount in the default store.
Method lock Return an async context-manager lock for key on the default store.
Async Method pull Return and immediately delete key from the default store.
Async Method remember Return the cached value for key; resolve and cache if absent.
Async Method rememberForever Return the cached value for key; resolve and cache forever if absent.
Async Method rememberOnce Coalesce misses in the default store with explicit admission bounds.
Async Method set Store value under key in the default store.
Async Method setMany Store multiple key/value pairs in the default store.
Method store Return the named or default cache repository.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _app Application container used to read config and the base path.
Instance Variable _base_path Base path obtained from app.basePath.
Instance Variable _config Validated configuration used to construct and operate the service.
Instance Variable _default Value used when the client omits this argument.
Instance Variable _prefix Prefix applied when constructing names or storage keys.
Instance Variable _repositories Cache repositories already resolved, indexed by store name.
Instance Variable _repositories_lock Serialize initial repository construction across calling threads.
def __init__(self: Self, app: IApplication): (source)

Initialize the manager and resolve the active cache configuration.

Parameters
app:orionis.IApplicationApplication container used to read config and the base path.
Returns
NoneNo return value.
def _buildBackend(self: Self, name: str) -> Any: (source)

Instantiate and return the raw backend for name.

Parameters
name:strDriver name: file, memory, Redis, Memcached or database.
Returns
typing.AnyConfigured backend instance.
Raises
orionis.cache.exceptions.CacheStoreExceptionWhen name is 'redis' or 'memcached' but the store is not configured.
def _buildDatabaseBackend(self: Self) -> Any: (source)

Instantiate and return the database cache backend.

Returns
typing.AnyConfigured orionis.cache.stores.database.DatabaseCacheBackend instance.
Raises
orionis.cache.exceptions.CacheStoreExceptionWhen the database store is not configured.
async def add(self: Self, key: str, value: Any, ttl: float | None = None) -> bool: (source)

Store value only if key is absent in the default store.

Parameters
key:strCache key.
value:typing.AnyValue to store.
ttl:float | NoneOptional TTL in seconds.
Returns
boolTrue on success, False when the key already exists.
async def clear(self: Self) -> bool: (source)

Remove all entries from the default store.

Returns
boolTrue on success.
async def decrement(self: Self, key: str, amount: int = 1) -> int: (source)

Decrement the integer at key by amount in the default store.

Parameters
key:strCache key.
amount:intAmount to subtract.
Returns
intNew value after decrement.
async def delete(self: Self, key: str) -> bool: (source)

Remove key from the default store.

Parameters
key:strCache key.
Returns
boolTrue if the key existed, False otherwise.
async def get(self: Self, key: str) -> Any: (source)

Retrieve the value for key from the default store.

Parameters
key:strCache key.
Returns
typing.AnyCached value, or None when absent.
async def getMany(self: Self, keys: list[str]) -> dict[str, Any]: (source)

Retrieve multiple values from the default store.

Parameters
keys:list[str]Cache keys to fetch.
Returns
dict[str, typing.Any]Mapping of key → value; missing keys map to None.
async def has(self: Self, key: str) -> bool: (source)

Check whether key exists and has not expired in the default store.

Parameters
key:strCache key.
Returns
boolTrue if the key is present and valid.
async def increment(self: Self, key: str, amount: int = 1) -> int: (source)

Increment the integer at key by amount in the default store.

Parameters
key:strCache key.
amount:intAmount to add.
Returns
intNew value after increment.
def lock(self: Self, key: str, timeout: float | None = None) -> Any: (source)

Return an async context-manager lock for key on the default store.

Parameters
key:strResource key to lock.
timeout:float | NoneStore-specific acquisition deadline or lease duration in seconds. None leaves file/database acquisition unbounded and uses the default lease for database and aiocache backends.
Returns
orionis.cache.locks.lock.CacheLockAsync context manager.
async def pull(self: Self, key: str) -> Any: (source)

Return and immediately delete key from the default store.

Parameters
key:strCache key.
Returns
typing.AnyCached value, or None when absent.
async def remember(self: Self, key: str, ttl: float | None, resolver: Callable) -> Any: (source)

Return the cached value for key; resolve and cache if absent.

Parameters
key:strCache key.
ttl:float | NoneTTL applied when caching the resolved value.
resolver:collections.abc.CallableZero-argument callable (sync or async) producing the value.
Returns
typing.AnyCached or freshly computed value.
async def rememberForever(self: Self, key: str, resolver: Callable) -> Any: (source)

Return the cached value for key; resolve and cache forever if absent.

Parameters
key:strCache key.
resolver:collections.abc.CallableZero-argument callable (sync or async) producing the value.
Returns
typing.AnyCached or freshly computed value.
async def rememberOnce(self: Self, key: str, ttl: float | None, resolver: Callable, *, wait_timeout: float = 10, lease: float | None = None) -> Any: (source)

Coalesce misses in the default store with explicit admission bounds.

Parameters
key:strCache key.
ttl:float | NoneResult lifetime according to the selected backend.
resolver:collections.abc.CallableZero-argument synchronous or asynchronous producer.
wait_timeout:floatMaximum seconds waiting for the current local resolver.
lease:float | NoneOptional backend lock lease; backend lock guarantees apply.
Returns
typing.AnyShared result, including None for overlapping calls.
async def set(self: Self, key: str, value: Any, ttl: float | None = None) -> bool: (source)

Store value under key in the default store.

Parameters
key:strCache key.
value:typing.AnyValue to cache.
ttl:float | NoneTime-to-live in seconds. None means no expiry.
Returns
boolTrue on success.
async def setMany(self: Self, values: dict[str, Any], ttl: float | None = None) -> bool: (source)

Store multiple key/value pairs in the default store.

Parameters
values:dict[str, typing.Any]Mapping of key → value.
ttl:float | NoneShared TTL in seconds.
Returns
boolTrue on success.
def store(self: Self, name: str | None = None) -> CacheRepository: (source)

Return the named or default cache repository.

The repository is created once on first access, including concurrent callers from different threads, and cached for reuse.

Parameters
name:str | NoneStore name: file, memory, Redis, Memcached or database. Defaults to the configured default store.
Returns
orionis.cache.CacheRepositoryRepository for the selected backend.
Raises
orionis.cache.exceptions.CacheStoreExceptionWhen the requested store is not configured.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

Application container used to read config and the base path.

_base_path: Path = (source)

Base path obtained from app.basePath.

Validated configuration used to construct and operate the service.

_default: str = (source)

Value used when the client omits this argument.

Prefix applied when constructing names or storage keys.

Cache repositories already resolved, indexed by store name.

_repositories_lock = (source)

Serialize initial repository construction across calling threads.