示例#1
0
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)
示例#2
0
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)
示例#3
0
文件: cache.py 项目: yf956613/opps
        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)
示例#4
0
文件: cache.py 项目: DjangoBD/opps
        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")
示例#6
0
def cache_page(timeout):
    return django_cache_page(timeout,
                             key_prefix=settings.CACHE_KEY_PREFIX +
                             'page_cache')