A Django-based convenience decorator for caching results of functions to various backends.
Project description
Django Function Cache
Cache the results of a function on S3 (and more!).
The function_cache
decorator enables flexibility in how cache key is generated.
Example
from django.contrib.staticfiles.storage import staticfiles_storage
from function_cache.decorators import function_cache
@function_cache(name='default', keys=('args[0]', 'args[1]', 'k'), storage=staticfiles_storage)
def create_dict(a, b, k=None, _cache_key=None):
print(f'The cache key is <{_cache_key}>.')
return dict(a=a, b=b, k=k)
#end def
def run():
x = create_dict('variable a', 'b', k={'keyword argument': 42})
#end def
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
function-cache-0.1.8.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for function_cache-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1d789794843ccdf28a2426cf6917767bf0e833cfd05dcd99168e5c395ad174a |
|
MD5 | 5b2769b9c458d4fc33943d1999f648ba |
|
BLAKE2b-256 | e784ab624f3e295e34c4fc26718fc313256cb28560c3a70538f7cf95d0275b17 |