-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RedisCacheStore#write_multi
to properly update the local store.
#43042
Conversation
`RedisCacheStore` specialises `write_multi` to use `mset` when possible, but it didn't update the local cache accordingly.
end | ||
|
||
if local_cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can use local_cache
directly here, see #38630 (comment).
How about overriding write_multi_entries
in the LocalCache module to clear the entries' keys?
def read_multi_entries(keys, **options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can, but we'll do the work multiple times in most cases as except for this one special cache for redis, write_multi_entries
is:
def write_multi_entries(hash, **options)
hash.each do |key, entry|
write_entry key, entry, **options
end
end
But given the restrictions on that specialized write_multi
(only used if no expiry), I wonder if we wouldn't be better to just remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said, "the work" is a simple Hash#[]=
per key. So might not matter much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @rafaelfranca what do you think?
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
RedisCacheStore
specialiseswrite_multi
to usemset
when possible, but it didn't update the local cache accordingly.Unless I'm mistaken, I think the bug was present in the initial version #31134
cc @jeremy