mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
Adds the ability to replace/extend caching backend (#7856)
* Add ability to override cache backend with custom module * Tests for setup_cache * Add custom CACHE_CONFIG documentation * Fix linter errors and documentation link * Fix black formatting errors
This commit is contained in:
committed by
Maxime Beauchemin
parent
7946165e6e
commit
df051813d5
@@ -775,8 +775,14 @@ def choicify(values):
|
||||
|
||||
def setup_cache(app: Flask, cache_config) -> Optional[Cache]:
|
||||
"""Setup the flask-cache on a flask app"""
|
||||
if cache_config and cache_config.get("CACHE_TYPE") != "null":
|
||||
return Cache(app, config=cache_config)
|
||||
if cache_config:
|
||||
if isinstance(cache_config, dict):
|
||||
if cache_config.get("CACHE_TYPE") != "null":
|
||||
return Cache(app, config=cache_config)
|
||||
else:
|
||||
# Accepts a custom cache initialization function,
|
||||
# returning an object compatible with Flask-Caching API
|
||||
return cache_config(app)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user