Adds easy cache support to Flask.
This is a fork of the Flask-Cache extension and the following pull requests have been merged into this fork:
- #90 Update documentation: route decorator before cache
- #95 Pass the memoize parameters into unless().
- #109 wrapped function called twice
- #117 Moves setting the app attribute to the _set_cache method
- #121 fix doc for delete_memoized
- #122 Added proxy for werkzeug get_dict
- #123 "forced_update" option to 'cache' and 'memoize' decorators
- #124 Fix handling utf8 key args (cherry-picked)
- #125 Fix unittest failing for redis unittest
- #127 Improve doc for using @cached on view
- #128 Doc for delete_memoized
- #129 tries replacing inspect.getargspec with either signature or getfullargspec if possible
For the complete changelog, have a look at the CHANGES
file.
The Cache Extension can either be initialized directly:
from flask import Flask
from flask_caching import Cache
app = Flask(__name__)
# For more configuration options, check out the documentation
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
Or through the factory method:
cache = Cache(config={'CACHE_TYPE': 'simple'})
app = Flask(__name__)
cache.init_app(app)