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
예제 #2
0
 def my_cached(context):
     return cached(timeout=60) if context['flag'] else lambda x: x
예제 #3
0
 def my_cached(flag):
     return cached(timeout=60) if flag else lambda x: x
예제 #4
0
 def my_cached(context):
     return cached(timeout=60) if context['flag'] else lambda x: x
예제 #5
0
 def my_cached(flag):
     return cached(timeout=60) if flag else lambda x: x
예제 #6
0
def cached(timeout, fragment_name, *extra):
    return cacheops.cached(timeout=timeout, extra=(fragment_name, ) + extra)
예제 #7
0
def cached(timeout, fragment_name, *extra):
    return cacheops.cached(timeout=timeout, extra=(fragment_name,) + extra)
예제 #8
0
파일: webutils.py 프로젝트: sleep3r/elogs
def max_cache(func):
    return cached(timeout=settings.MAX_CACHE_TIME)(func)