storing cache using dynamodb
Project description
dynamocacher
Description
A package which allows you to use dynamodb to cache
ToDos
- Dax support
- Auto create table
- policy template
- example readme
Examples
SetUp
from dynamocacher.cacher import Cacher
class Cache(Cacher):
class Meta:
table_name = 'dynamoCache'
region = 'us-east-1'
aws_access_key_id = USER
aws_secret_access_key = PW
billing_mode= 'PAY_PER_REQUEST'
createTable
Cache.create_table()
addCache
sampleInput = {
'query': 'testQuery',
'fruit': 'strawberry'
}
sampleInput2 = {
'query': 'testQuery',
'fruit': 'orange'
}
sampleReturn = {
'pine': 'apple'
}
Cache.addCache(
input = sampleInput,
output = sampleReturn
)
getCache
output = Cache.getCache(sampleInput, timeout = 3600) # ignore cache older than 3600 seconds
print(output)
{"pine": "apple"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dynamocacher-0.0.7.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for dynamocacher-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6bd7f2a1f844f140bca4f650ea8dd374e5ebf859ccfc4d02dc6eccab4a409ea |
|
MD5 | f98cd94bb331991adeb9e11883aa5120 |
|
BLAKE2b-256 | 2f0ecb1c27e3532372389031179d45accca0efcbe6b9126e0ed03472a8776c64 |