def cache_wrap(timeout=settings.CACHE_TTL): if _is_cacheops_enabled(): from cacheops import cached return cached(timeout=timeout) # put a fake cache function on global scope so it doesn't complain def do_nothing(fn): return fn return do_nothing
def my_cached(context): return cached(timeout=60) if context['flag'] else lambda x: x
def my_cached(flag): return cached(timeout=60) if flag else lambda x: x
def cached(timeout, fragment_name, *extra): return cacheops.cached(timeout=timeout, extra=(fragment_name, ) + extra)
def cached(timeout, fragment_name, *extra): return cacheops.cached(timeout=timeout, extra=(fragment_name,) + extra)
def max_cache(func): return cached(timeout=settings.MAX_CACHE_TIME)(func)