Fix query cache for multiple connections
#34491

eileencodes wants to merge fix-query-cache-on-multiple-connections into master

We do not currently have an analysis of these two commits