Can someone explain the Rails 5.2 "recyclable cache key" scheme?
Robb Shecter May 16
I've been through the PR, code, comments, and docs, but can't piece it together.
My best guess:
In Rails 5.1 and earlier, the entire key is used to determine if the object is in the cache. In Rails 5.2 and later, the key alone is not enough to determine this. Now, the "options" are examined as well, on the Rails application side, to see if the options/version matches. And if the cached item is expired, then Rails will issue a
replace instead of an
add to the cache store.
So the theoretical result after an object is modified:
In Rails 5.1: Two cache entries, one "trash", and one current.
In Rails 5.2: One cache entry, updated with new content and version in options metadata.
(I have a more detailed version of this post on Reddit.)