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
Add delete_multi
method to cache
#36927
Conversation
Nice feature! Observe the interaction between read_multi
(public API implemented once in base class) and read_multi_entries
(private implementation; default in base class, overridden in subclasses). You can follow this pattern with delete_multi
(public API) and delete_multi_entries
(private implementation) as well.
e0bcb4e
to
a862d59
Compare
Hey @jeremy, thanks for the review! I've updated the implementation with your suggestions, please take another look! |
a862d59
to
a78958d
Compare
Hey @jeremy, could I get another review please? |
a78958d
to
ff611b4
Compare
Awesome! We used a custom implementation and can now switch back to the default again! Thanks @peterzhu2118 |
@cache.write("foo", "bar") | ||
assert @cache.exist?("foo") | ||
@cache.write("hello", "world") | ||
assert @cache.exist?("foo") |
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.
it it the good assertion here?
Summary
Adds
ActiveSupport::Cache::Store#delete_multi
to delete an array of keys from the cache.For most implementations, this just calls
ActiveSupport::Cache::Store#delete
n
times, but Redis supports deleting an array of keys. This can improve performance because it turns what is previouslyn
delete calls into a single call.Memcached does not support multi delete.