file_backend#
- class starlite.middleware.session.file_backend.FileStorageMetadataWrapper#
Bases:
NamedTuple
Metadata of a session file.
- class starlite.middleware.session.file_backend.FileBackend#
Bases:
ServerSideBackend
[FileBackendConfig
]Session backend to store data in files.
- __init__(config: FileBackendConfig) None #
Initialize
FileBackend
- Parameters:
config – A
FileBackendConfig
- async get(session_id: str) Optional[bytes] #
Load data associated with
session_id
from a file.- Parameters:
session_id – The session-ID
- Returns:
The session data, if existing, otherwise
None
.
- async set(session_id: str, data: bytes) None #
Store
data
alongside metadata under thesession_id
, using the ID as a filename. If a file already exists forsession_id
, replace it withdata
and reset its expiry time.- Parameters:
session_id – The session-ID
data – Serialized session data
- Returns:
None
- class starlite.middleware.session.file_backend.FileBackendConfig#
Bases:
ServerSideSessionConfig
Backend configuration for
FileBackend