Memoization function decorators using Amazon S3 for Python
Project description
Memoization function decorators using Amazon S3 for Python
Install
pip install s3-memoize
Usage
Setup AWS credentials (e.g. myprofile).
Make a S3 bucket (e.g. mybucketname).
Make test.py.
BUCKET_NAME='mybucketname'
@s3_fifo_cache(maxsize=2, typed=False, bucket_name=BUCKET_NAME)
# @s3_lru_cache(maxsize=2, typed=False, bucket_name=BUCKET_NAME)
def test(num):
print(f'test: {num}')
return num * 2
print(test.cache_clear())
print(test.cache_info())
print(test(10))
print(test.cache_info())
print(test(10))
print(test.cache_info())
print(test(20))
print(test.cache_info())
print(test(20))
print(test.cache_info())
print(test(10))
print(test.cache_info())
print(test(30))
print(test.cache_info())
print(test(30))
print(test.cache_info())
Run.
AWS_PROFILE=myprofile python test.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
s3_memoize-0.1.2.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for s3_memoize-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3d0d064a2d8975b22c1cf358e6fbfc2966212a6544e2adb7a5ee53452491b0 |
|
MD5 | bccb314acb0e092977a0649abd195bb7 |
|
BLAKE2b-256 | aa44bd8aa776af447d66d327f82d4bf62d09e967b92427c5a53dd658c839c6d9 |