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 CacheSessionStore(ISessionStore): (source)
Constructor: CacheSessionStore(cache, store)
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. |
Bind the store to the requested (or default) cache repository.
| Parameters | |
cache:orionis.cache.contracts.ICacheManager | The application's cache manager. |
store:str | None, optional | Name of the cache store to use. None selects the configured default store. |
| Returns | |
None | No return value. |
Return the stored record for session_id, or None.
| Parameters | |
sessionstr | Unique session identifier to look up. |
| Returns | |
orionis.session.entities.record.SessionRecord | None | The stored record, or None when absent or expired. |
Replace a live cache session without recreating a missing key.
| Parameters | |
record:orionis.session.entities.record.SessionRecord | Replacement record. |
| Returns | |
bool | Whether the cache atomically replaced a live record. Return False when the replacement has less than one full second remaining. |
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.SessionRecord | The record to persist. |
| Returns | |
None | No return value. |