I am encountering a problem when using Flask-Cache. I need to do caching as needed by specifying a configuration variable that the user can set to enable or disable caching.
I use Flask-Cache for caching since
cache = Cache (config = {'CACHE_TYPE': 'redis'})
app = Flask ( name )
To initialize the cache
cache.init_app (application)
Clear cache
with app.app_context ():
cache.clear()
And using the cache (in views.py) as
@ app.route ('/', methods = ['GET'])
@validate_access (current_user, "read")
@login_required
@ cache.memoize ()
def get_values ββ(id):
return get_values()
I do not get the correct way to enable / disable caching when using Flask-Cache. Is there a standard way by which we can completely enable / disable cache behavior.
python flask caching flask-extensions
am
source share