robdiciuccio commented on a change in pull request #11499:
URL: 
https://github.com/apache/incubator-superset/pull/11499#discussion_r535674186



##########
File path: superset/common/query_context.py
##########
@@ -201,7 +232,18 @@ def cache_timeout(self) -> int:
             return self.datasource.database.cache_timeout
         return config["CACHE_DEFAULT_TIMEOUT"]
 
-    def cache_key(self, query_obj: QueryObject, **kwargs: Any) -> 
Optional[str]:
+    def cache_key(self, **extra: Any) -> str:
+        """
+        The cache key is made out of the key/values from self.cached_values, 
plus any
+        other key/values in `extra`
+        """
+        key_prefix = "qc-"
+        cache_dict = self.cache_values.copy()
+        cache_dict.update(extra)
+
+        return generate_cache_key(cache_dict, key_prefix)

Review comment:
       Not sure how this would cause cache misses, as it's separate from the 
`query_obj.cache_key`. This cache key is generated from the relevant 
`QueryContext` values and passed directly into an async event payload 
([here](https://github.com/apache/incubator-superset/blob/e2dc30eab4f315f110a383b516cf70bd622496fe/superset/tasks/async_queries.py#L48))
 that is consumed by the async event frontend middleware. The `QueryContext` 
object wasn't previously cached, so I don't think this should affect any chart 
data query caching, unless I'm missing something.




----------------------------------------------------------------
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