robdiciuccio commented on a change in pull request #11499:
URL:
https://github.com/apache/incubator-superset/pull/11499#discussion_r537741235
##########
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:
Yep, that makes sense. I guess my point here is that we're not doing a
reverse-lookup of a cached `QueryContext` object based on the contents of the
object. We're only ever loading this cached object via the cache key, so the
contents that determine the cache key simply need to be unique enough not to
collide with other objects.
----------------------------------------------------------------
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]