Skip to main content

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.


from 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for function-cache, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size function-cache-0.1.6.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page