Several Rails developers have identified a bug in which Active Record
collections using a limit or offset (i.e. used for paginating records)
don't always return fresh cache key versions after their contents have
changed. (See comments on pull request #20884
<>, and
 issues #31996 <>, #34408
<> and #37555

This is due to the current mechanism for generating cache key versions (a
collection's size concatenated with its maximum updated_at timestamp),
which isn't quite robust/unique enough. I propose to mitigate this by
including a collection's first and last IDs in its cache version, for
collections using a limit or offset:

(I submitted my pull request a couple weeks ago - I'm aware a lot of folks
may be taking time off for the holidays, but am creating a new thread
hoping to attract some reviewers/feedback. Any attention from the Rails
team or others is greatly appreciated!)

Anyway, there are a couple ways we might go about attacking this - in
particular PR #21503 <> proposes
including a hash digest of IDs to ensure fresh cache versions. (Please see
my pull request's summary for a more detailed analysis of alternative
solutions.) Regardless of which way we go, I'm hoping we engineer a

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit

Reply via email to