缓存视图函数
使用装饰器 cached() 能够缓存视图函数。它在默认情况下使用请求路径(request.path)作为cache_key:
1. @cache.cached(timeout=50)
2. def index():
3. return render_template('index.html')
该装饰器有一个可选的参数:unless,它允许一个可调用的、返回值是True或者False的函数。如果 unless 返回 True,将会完全忽略缓存机制(内置的缓存机制会完全不起作用)。
