mirror of
https://github.com/kennethreitz/flask-common.git
synced 2026-06-05 23:00:19 +00:00
adding a new option to define the cache type
This commit is contained in:
@@ -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
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user