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 CacheSessionStore(ISessionStore): (source)

Constructor: CacheSessionStore(cache, store)

View In Hierarchy

Session store backed by the framework's cache system.

Persist each session as one cache entry. Truncate its remaining TTL to whole seconds so rounding cannot prolong the record's deadline. This can expire a record up to one second early; deadlines less than one full second away cannot be persisted or renewed. Actual eviction timing still depends on the backend, its clock and transport latency.

Notes

ICacheManager exposes no way to enumerate stored keys, so this store cannot (and does not need to) implement an active orionis.session.stores.cache.CacheSessionStore.gc: the backend enforces expiration. Physical removal of stale entries depends on that backend's cleanup policy and may occur only when they are read.

Method __init__ Bind the store to the requested (or default) cache repository.
Async Method delete Remove the record for session_id (no-op when absent).
Async Method gc Leave expiration cleanup to the cache backend's TTL.
Async Method read Return the stored record for session_id, or None.
Async Method update Replace a live cache session without recreating a missing key.
Async Method write Insert or replace the record keyed by its identifier.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _repository Repository produced by cache.store.
def __init__(self, cache: ICacheManager, store: str | None = None): (source)

Bind the store to the requested (or default) cache repository.

Parameters
cache:orionis.cache.contracts.ICacheManagerThe application's cache manager.
store:str | None, optionalName of the cache store to use. None selects the configured default store.
Returns
NoneNo return value.
async def delete(self, session_id: str) -> bool: (source)

Remove the record for session_id (no-op when absent).

Parameters
session_id:strUnique session identifier to remove.
Returns
boolTrue only when an entry was deleted.
async def gc(self): (source)

Leave expiration cleanup to the cache backend's TTL.

Returns
NoneNo return value.
async def read(self, session_id: str) -> SessionRecord | None: (source)

Return the stored record for session_id, or None.

Parameters
session_id:strUnique session identifier to look up.
Returns
orionis.session.entities.record.SessionRecord | NoneThe stored record, or None when absent or expired.
async def update(self, record: SessionRecord) -> bool: (source)

Replace a live cache session without recreating a missing key.

Parameters
record:orionis.session.entities.record.SessionRecordReplacement record.
Returns
boolWhether the cache atomically replaced a live record. Return False when the replacement has less than one full second remaining.
async def write(self, record: SessionRecord): (source)

Insert or replace the record keyed by its identifier.

The cache entry's TTL is derived from record.expires_at; a record with less than one full second remaining is deleted instead.

Parameters
record:orionis.session.entities.record.SessionRecordThe record to persist.
Returns
NoneNo return value.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_repository: ICacheRepository = (source)

Repository produced by cache.store.