adding a new option to define the cache type

This commit is contained in:
Henrique Lopes
2017-09-29 22:35:33 -03:00
parent ddb75e5419
commit cd40abbd58
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -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"
+1 -1
View File
@@ -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():