memory#
- class litestar.stores.memory.MemoryStore#
Bases:
Store
In memory, atomic, asynchronous key/value store.
- __init__() None #
Initialize
MemoryStore
- async set(key: str, value: str | bytes, expires_in: int | timedelta | None = None) None #
Set a value.
- Parameters:
key – Key to associate the value with
value – Value to store
expires_in – Time in seconds before the key is considered expired
- Returns:
None
- async get(key: str, renew_for: int | timedelta | None = None) bytes | None #
Get a value.
- Parameters:
key – Key associated with the value
renew_for – If given and the value had an initial expiry time set, renew the expiry time for
renew_for
seconds. If the value has not been set with an expiry time this is a no-op
- Returns:
The value associated with
key
if it exists and is not expired, elseNone
- async delete(key: str) None #
Delete a value.
If no such key exists, this is a no-op.
- Parameters:
key – Key of the value to delete