def cache_page(view): fname = view.__module__ + '.' + view.__name__ try: seconds = settings.CACHE_TIMES[fname] except: seconds = 60 if seconds is None: return view return django_cache_page(seconds)(view)
def wrapped(*func_args, **func_kwargs): request = func_args[0] cache_prefix = u'{0}-{1}-{2}'.format( key_prefix, get_current_site(request).domain, getattr(request, 'is_mobile', False)) do_cache = django_cache_page( cache_timeout, cache=cache_alias, key_prefix=cache_prefix)( lambda *args, **kwargs: func(*func_args, **func_kwargs)) return do_cache(*func_args, **func_kwargs)
def wrapped(*func_args, **func_kwargs): request = func_args[0] cache_prefix = u'{0}-{1}-{2}'.format( key_prefix, get_current_site(request).domain, getattr(request, 'is_mobile', False) ) do_cache = django_cache_page( cache_timeout, cache=cache_alias, key_prefix=cache_prefix )(lambda *args, **kwargs: func(*func_args, **func_kwargs)) return do_cache(*func_args, **func_kwargs)
def cache_page(timeout): return django_cache_page(timeout, key_prefix=settings.CACHE_KEY_PREFIX + "page_cache")
def cache_page(timeout): return django_cache_page(timeout, key_prefix=settings.CACHE_KEY_PREFIX + 'page_cache')