Caching
Caching¶
Classes:
Name | Description |
---|---|
BaseCache |
Base class for a cache. |
BaseCache
¶
Base class for a cache.
Methods:
Name | Description |
---|---|
__init__ |
Initialize the cache with a serializer. |
get |
Get the cached values for the given keys. |
aget |
Asynchronously get the cached values for the given keys. |
set |
Set the cached values for the given keys and TTLs. |
aset |
Asynchronously set the cached values for the given keys and TTLs. |
clear |
Delete the cached values for the given namespaces. |
aclear |
Asynchronously delete the cached values for the given namespaces. |
__init__
¶
__init__(
*, serde: SerializerProtocol | None = None
) -> None
Initialize the cache with a serializer.
get
abstractmethod
¶
Get the cached values for the given keys.
aget
abstractmethod
async
¶
Asynchronously get the cached values for the given keys.
set
abstractmethod
¶
Set the cached values for the given keys and TTLs.
aset
abstractmethod
async
¶
Asynchronously set the cached values for the given keys and TTLs.
Classes:
Name | Description |
---|---|
InMemoryCache |
|
InMemoryCache
¶
Bases: BaseCache[ValueT]
Methods:
Name | Description |
---|---|
get |
Get the cached values for the given keys. |
aget |
Asynchronously get the cached values for the given keys. |
set |
Set the cached values for the given keys. |
aset |
Asynchronously set the cached values for the given keys. |
clear |
Delete the cached values for the given namespaces. |
aclear |
Asynchronously delete the cached values for the given namespaces. |
get
¶
Get the cached values for the given keys.
aget
async
¶
Asynchronously get the cached values for the given keys.
set
¶
Set the cached values for the given keys.
aset
async
¶
Asynchronously set the cached values for the given keys.
Classes:
Name | Description |
---|---|
SqliteCache |
File-based cache using SQLite. |
SqliteCache
¶
Bases: BaseCache[ValueT]
File-based cache using SQLite.
Methods:
Name | Description |
---|---|
__init__ |
Initialize the cache with a file path. |
get |
Get the cached values for the given keys. |
aget |
Asynchronously get the cached values for the given keys. |
set |
Set the cached values for the given keys and TTLs. |
aset |
Asynchronously set the cached values for the given keys and TTLs. |
clear |
Delete the cached values for the given namespaces. |
aclear |
Asynchronously delete the cached values for the given namespaces. |
__init__
¶
__init__(
*, path: str, serde: SerializerProtocol | None = None
) -> None
Initialize the cache with a file path.
get
¶
Get the cached values for the given keys.
aget
async
¶
Asynchronously get the cached values for the given keys.
set
¶
Set the cached values for the given keys and TTLs.
aset
async
¶
Asynchronously set the cached values for the given keys and TTLs.