You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/01/25 03:33:39 UTC

[GitHub] [incubator-superset] craig-rueda commented on a change in pull request #9020: [Caching] Ensure cache is always created

craig-rueda commented on a change in pull request #9020: [Caching] Ensure cache is always created
URL: https://github.com/apache/incubator-superset/pull/9020#discussion_r370911191
 
 

 ##########
 File path: superset/utils/cache_manager.py
 ##########
 @@ -27,30 +27,26 @@ def __init__(self) -> None:
         self._tables_cache = None
         self._cache = None
 
-    def init_app(self, app):
-        self._cache = self._setup_cache(app, app.config.get("CACHE_CONFIG"))
+    def init_app(self, app: Flask) -> None:
+        self._cache = self._setup_cache(app, app.config["CACHE_CONFIG"])
         self._tables_cache = self._setup_cache(
-            app, app.config.get("TABLE_NAMES_CACHE_CONFIG")
+            app, app.config["TABLE_NAMES_CACHE_CONFIG"]
         )
 
     @staticmethod
-    def _setup_cache(app: Flask, cache_config) -> Optional[Cache]:
+    def _setup_cache(app: Flask, cache_config: CacheConfig) -> Cache:
         """Setup the flask-cache on a flask app"""
-        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)
+        if isinstance(cache_config, dict):
 
 Review comment:
   Nice, this was confusing logic

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org