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.7.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for function_cache-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa46f93fb8f0a2c038f3649b9fd136291fafb31484995cf11add3b4015745997 |
|
MD5 | 69b2968c97e994e9aa06e25dbfde9345 |
|
BLAKE2b-256 | fbde734bcec01006d1eeb77617f740dc916d88b86c43e294f03009a4e349c02a |