[Bug fix][Active Record] Cache keys failing to correctly expire for collections with offset/limit
I'm seeking to resolve a several year old bug in the way Active Record generates cache key versions for collections using an offset or limit. This bug arises in the real world when paginating records (as reported via #31996, #34408 and #37555).
Please refer to my pull request's summary for a more detailed explanation of the issue, plus benchmarks for my proposed fix:
One concern folks may have with this solution is that it moves somewhat higher-level cache key logic to the connector level. However after considering alternatives for some time, I'm confident this is the cleanest path to support multiple RDBMSs.
Hoping a member of the Rails team may find the time to review and/or approve my solution. Any feedback from the broader community greatly appreciated as well!