Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(caching): support metastore cache for non-required caches #19369

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions superset/utils/cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _init_cache(
) -> None:
cache_config = app.config[cache_config_key]
cache_type = cache_config.get("CACHE_TYPE")
if required and cache_type in (None, "SupersetMetastoreCache"):
if required and cache_type is None or cache_type == "SupersetMetastoreCache":
if cache_type is None and not app.debug:
logger.warning(
"Falling back to the built-in cache, that stores data in the "
Expand All @@ -49,12 +49,13 @@ def _init_cache(
"another dedicated caching backend for production deployments",
cache_config_key,
)
cache_type = CACHE_IMPORT_PATH
cache_key_prefix = cache_config.get("CACHE_KEY_PREFIX", cache_config_key)
cache_config.update(
{"CACHE_TYPE": CACHE_IMPORT_PATH, "CACHE_KEY_PREFIX": cache_key_prefix}
{"CACHE_TYPE": cache_type, "CACHE_KEY_PREFIX": cache_key_prefix}
)

if "CACHE_DEFAULT_TIMEOUT" not in cache_config:
if cache_type is not None and "CACHE_DEFAULT_TIMEOUT" not in cache_config:
default_timeout = app.config.get("CACHE_DEFAULT_TIMEOUT")
cache_config["CACHE_DEFAULT_TIMEOUT"] = default_timeout

Expand Down