aiohttp_client_cache.backends.dynamodb module¶
-
class
aiohttp_client_cache.backends.dynamodb.
DynamoDBBackend
(cache_name='aiohttp-cache', **kwargs)[source]¶ Bases:
aiohttp_client_cache.backends.base.CacheBackend
DynamoDB cache backend. See
DynamoDbCache
for backend-specific options See DynamoDB Service Resource for more usage details.See
CacheBackend
for args.
-
class
aiohttp_client_cache.backends.dynamodb.
DynamoDbCache
(table_name, namespace='dynamodb_dict_data', connection=None, region_name='us-east-1', read_capacity_units=1, write_capacity_units=1, **kwargs)[source]¶ Bases:
aiohttp_client_cache.backends.base.BaseCache
An async-compatible interface for caching objects in a DynamoDB key-store
The actual key name on the dynamodb server will be
namespace:table_name
. In order to deal with how dynamodb stores data/keys, all values must be pickled.- Parameters
table_name (
str
) – Table name to usenamespace (
str
) – Name of the hash map stored in dynamodbconnection (
Optional
[ServiceResource
]) – An existing resource object to reuse instead of creating a new oneregion_name (
str
) – AWS region of DynamoDB databasekwargs – Additional keyword arguments for DynamoDB
ServiceResource
-
_abc_impl
= <_abc_data object>¶
-
async
contains
(key)[source]¶ Check if a key is stored in the cache
- Return type
bool
- Parameters
key (str) –
-
async
delete
(key)[source]¶ Delete a single item from the cache. Does not raise an error if the item is missing.
- Parameters
key (str) –
-
async
read
(key)[source]¶ Read a single item from the cache. Returns
None
if the item is missing.- Return type
Union
[CachedResponse
,None
,bytes
,str
]- Parameters
key (str) –
-
static
unpickle
(response_item)[source]¶ - Return type
Union
[CachedResponse
,None
,bytes
,str
]- Parameters
response_item (Dict) –
-
async
values
()[source]¶ Get all values stored in the cache
- Return type
Iterable
[Union
[CachedResponse
,None
,bytes
,str
]]
-
async
write
(key, item)[source]¶ Write an item to the cache
- Parameters
key (str) –
item (Union[aiohttp_client_cache.response.CachedResponse, None, bytes, str]) –