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
Esempio n. 2
0
 def my_cached(context):
     return cached(timeout=60) if context['flag'] else lambda x: x
Esempio n. 3
0
 def my_cached(flag):
     return cached(timeout=60) if flag else lambda x: x
Esempio n. 4
0
 def my_cached(context):
     return cached(timeout=60) if context['flag'] else lambda x: x
Esempio n. 5
0
 def my_cached(flag):
     return cached(timeout=60) if flag else lambda x: x
Esempio n. 6
0
def cached(timeout, fragment_name, *extra):
    return cacheops.cached(timeout=timeout, extra=(fragment_name, ) + extra)
Esempio n. 7
0
def cached(timeout, fragment_name, *extra):
    return cacheops.cached(timeout=timeout, extra=(fragment_name,) + extra)
Esempio n. 8
0
def max_cache(func):
    return cached(timeout=settings.MAX_CACHE_TIME)(func)