我怎样才能配置Flask缓存无限超时 [英] How can I configure Flask-Cache with infinite timeout

查看:520
本文介绍了我怎样才能配置Flask缓存无限超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flask-Cache文档中,所有示例都使用有限的超时。

我想在应用程序运行时不刷新缓存。这是可能的,如果是的话,我该怎么做?

解决方案 。从文档中可以清楚地看出,


超时时间为0表示缓存永不过期。

支持无限缓存,可以通过将超时设置为零来打开。


In the Flask-Cache documentation all the examples use a finite timeout.

I'd like to never refresh the cache while the app is running. Is this possible, and if so how do I do it?

解决方案

Flask-Cache uses werkzeug.contrib.cache behind the scenes. From the documentation it's made clear that

A timeout of 0 indicates that the cache never expires.

So yes, infinite caching is supported and can be turned on by setting the timeout to zero.

这篇关于我怎样才能配置Flask缓存无限超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆