I am facing an issue where I am using the Flask cache module and in the case I have a runtime error I don't want the view cached.
Can anyone advise how to do this?
Here is what I would like to achieve.
from flask import Flask
from flask.ext.cache import Cache
app = Flask(__name__)
mycache = Cache()
mycache.init_app(app)
@mycache.cached()
@app.route('/myview')
def process_view():
try:
return get_something()
except:
return print_error_and_no_cache_this_view()
Any thoughts on how I stop this view being cached if I have an error?