This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Add initial value support to MemCacheStore increment and decrement calls#1
Closed
Add initial value support to MemCacheStore increment and decrement calls#1
Conversation
eugeneius
reviewed
May 4, 2022
|
This needs a changelog entry, since we're changing the default behaviour when the key is missing. We should make the same change to https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#increment-decrement
|
eugeneius
reviewed
May 5, 2022
activesupport/test/cache/behaviors/cache_increment_decrement_behavior.rb
Outdated
Show resolved
Hide resolved
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
…ehavior.rb Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
eugeneius
reviewed
May 9, 2022
eugeneius
reviewed
May 9, 2022
eugeneius
reviewed
May 9, 2022
eugeneius
reviewed
May 10, 2022
eugeneius
reviewed
May 10, 2022
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
eugeneius
reviewed
May 11, 2022
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ActiveSupport::Cache::MemCacheStorecache storeincrementanddecrementcalls do not have support for setting an initial value on first call even though that is supported by the Dalli client underneath: https://github.com/petergoldstein/dalli/blob/5588d98f79eb04a9abcaeeff3263e08f93468b30/lib/dalli/protocol/binary.rb#L111This change adds the ability to use the
:initialoption to set one.Before this change, to set and increment a counter one needed to do the following:
After the change, you can combine the two:
or call the operations without doing the
writeat all and it will assume the initial value from the amount (for increment) or 0 (for decrement):