Fix query cache when using shared connections
#36618

engwan wants to merge engwan:fix-query-cache-with-shared-ar-connection into rails:master

We do not currently have an analysis of these two commits