Versatile persisent file cache.
Project description
Installation
$ pip install bucketcache
Automatic Generation
In one sentence, Bucket is a container object with optional lifetime backed by configurable serialisation methods that can also act as a function or method decorator.
Before everything is explained in detail, here’s a quick look at the functionality:
Container:
from bucketcache import Bucket
bucket = Bucket('cache', hours=1)
bucket[any_object] = anything_serializable_by_backend # (Pickle is the default)
Decorator:
class SomeService(object):
def __init__(self, username, password):
self.username = username
self.password = password
@bucket(method=True, nocache='skip_cache')
def expensive_method(self, a, b, c, skip_cache=False):
print('Method called.')
@expensive_method.callback
def expensive_method(callinfo):
print('Cache used.')
some_service = SomeService()
some_service.expensive_method(1, 2, 3)
some_service.expensive_method(1, 2, 3)
some_service.expensive_method(1, 2, 3, skip_cache=True)
Method called. Cache used. Method called
For in-depth information, visit the documentation!
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
BucketCache-0.11.3.tar.gz
(19.3 kB
view details)
Built Distribution
File details
Details for the file BucketCache-0.11.3.tar.gz
.
File metadata
- Download URL: BucketCache-0.11.3.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de78a3524ed1c34710179b065280912b9ebf4ddb8ec18a0e0433f55b295bc426 |
|
MD5 | 2802f4d7b2bdc6ea3c686c15e39e7467 |
|
BLAKE2b-256 | d9668f2cff1d6d8783c3c3130233409965c725e997ad410b679ae72ef1b53b66 |
Provenance
File details
Details for the file BucketCache-0.11.3-py3-none-any.whl
.
File metadata
- Download URL: BucketCache-0.11.3-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de578d4dd8f99b12fa78cccea6e22277a8e0c181b0f7fe217e8c45c79b3ac4a |
|
MD5 | 169c114da39131ccdcddc45a98e386ec |
|
BLAKE2b-256 | 4747b33588cf3fb6137cf875d54e1beb25a5a886d9374104d98bbba3f4bfa556 |