Skip to content

Instantly share code, notes, and snippets.

@jsbueno
jsbueno / cache.py
Last active December 21, 2015 08:59
def cache_page(*dec_args, **dec_kwargs):
cache_timeout = dec_args[0] if dec_args else None
cache_alias = dec_kwargs.pop('cache', None)
key_prefix = dec_kwargs.pop('key_prefix', '')
def decorator(func):
def wrapped(*func_args, **func_kwargs):
request = func_args[0]
cache_prefix = u'{}-{}-{}'.format(
key_prefix,