清除缓存
请参看 clear().
下面的例子是一个用来清空应用缓存的脚本:
1. from flask.ext.cache import Cache
3. from yourapp import app, your_cache_config
5. cache = Cache()
7. def main():
8. cache.init_app(app, config=your_cache_config)
10. with app.app_context():
11. cache.clear()
13. if __name__ == '__main__':
14. main()
Warning
某些缓存类型不支持完全清空缓存。同样,如果你不使用键前缀,一些缓存类型将刷新整个数据库。请确保你没有任何其他数据存储在缓存数据库中。
