title: How to invalidate or delete a redis cache object if an error in Flask view
body: <p>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.</p>
  
  <p>Can anyone advise how to do this?</p>
  
  <p>Here is what I would like to achieve.</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>Any thoughts on how I stop this view being cached if I have an error?</p>