diff --git a/README.md b/README.md index 985d0ba..6b9b1b1 100644 --- a/README.md +++ b/README.md @@ -61,3 +61,7 @@ Flask-Common automatically configures [WhiteNoise](http://whitenoise.evans.io) t app.config['COMMON_POWERED_BY_DISABLED'] = 1 app.config['COMMON_PROCESSED_TIME_DISABLED'] = 1 +## Cache configures + By default *simple* is a default cache type. But can you change this options, following below steps. [Flask-Cache](https://pythonhosted.org/Flask-Cache/#configuring-flask-cache) + + app.config['COMMON_CACHE_TYPE'] = "simple" diff --git a/flask_common.py b/flask_common.py index b96d678..673b055 100644 --- a/flask_common.py +++ b/flask_common.py @@ -113,7 +113,7 @@ class Common(object): # Configure WhiteNoise. app.wsgi_app = WhiteNoise(app.wsgi_app, root=url_for('static', filename='')[1:]) - self.cache = Cache(app, config={'CACHE_TYPE': 'simple'}) + self.cache = Cache(app, config={'CACHE_TYPE': app.config.get("COMMON_CACHE_TYPE", 'simple')}) @app.before_request def before_request_callback():