ktmud commented on a change in pull request #11509:
URL: 
https://github.com/apache/incubator-superset/pull/11509#discussion_r520858257



##########
File path: superset/utils/cache.py
##########
@@ -40,38 +53,103 @@ def memoized_func(
     timeout of cache is set to 600 seconds by default,
     except cache_timeout = {timeout in seconds} is passed to the decorated 
function.
 
-    memoized_func uses simple_cache and stored the data in memory.
-    Key is a callable function that takes function arguments and
-    returns the caching key.
+    Paramaters
+    ------------
+        key: a callable function that takes function arguments and returns the 
caching
+             key.
     """
 
     def wrap(f: Callable[..., Any]) -> Callable[..., Any]:
-        if cache_manager.tables_cache:
-
-            def wrapped_f(self: Any, *args: Any, **kwargs: Any) -> Any:
-                if not kwargs.get("cache", True):
-                    return f(self, *args, **kwargs)
-
-                if attribute_in_key:
-                    cache_key = key(*args, **kwargs).format(
-                        getattr(self, attribute_in_key)
-                    )
-                else:
-                    cache_key = key(*args, **kwargs)
-                o = cache_manager.tables_cache.get(cache_key)
-                if not kwargs.get("force") and o is not None:
-                    return o
-                o = f(self, *args, **kwargs)
-                cache_manager.tables_cache.set(
-                    cache_key, o, timeout=kwargs.get("cache_timeout")
-                )
-                return o
-
-        else:
-            # noop
-            def wrapped_f(self: Any, *args: Any, **kwargs: Any) -> Any:
+        def wrapped_f(self: Any, *args: Any, **kwargs: Any) -> Any:
+            if not kwargs.get("cache", True):
                 return f(self, *args, **kwargs)
 
+            cache_key = key(self, *args, **kwargs)
+            o = cache.get(cache_key)

Review comment:
       Pylint didn't actually complain but I made the change anyway..




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to