flaskflask-cache

How can I configure Flask-Cache with infinite timeout


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?


Solution

  • 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.