开发者

Disable cache in Pylons app under development mode

I'm using @beaker_cache() decorator in my Pylons application. How can I disable the cach开发者_StackOverflow社区e under development mode?


You could write your own decorator which looks at pylons.config["debug"], and depending on that either returns function unchanged or decorated with beaker_cache. Something along these lines (completely untested!):

from pylons import config

def my_cache(*args, **kwargs):
    if config["debug"]:
        decorate = lambda f: f
    else: 
        decorate = beaker_cache(*args, **kwargs)

    return decorate
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜