Invalidate all query caches for current thread
#35089

eileencodes wants to merge eileencodes:fix-query-cache-for-database-switching into rails:master

We do not currently have an analysis of these two commits