fix: Redis#exists(key) returns Integer as the default behaviour - #1030
Closed
AkkyOrz wants to merge 1 commit into
Closed
fix: Redis#exists(key) returns Integer as the default behaviour#1030AkkyOrz wants to merge 1 commit into
AkkyOrz wants to merge 1 commit into
Conversation
Collaborator
Yes, the bug is that I forgot to change the default when I released 4.3 🤦 |
Collaborator
|
Fixed in cf7e628, thank you nonetheless for your PR. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
redis-rb/lib/redis.rb
Lines 576 to 596 in c97360b
After reading the error message, I interpreted it as follows. (The text in parentheses is my own completion)
Redis#exists(key)is supposed to return integer.Redis#exists?(key)instead (if you want to return a boolean in version 4.3 or later).Redis.exists_returns_integer = trueif you want to use the "new" behaviour (for users of version 4.3 or earlier)However, in my environment using redis-rb 4.4, when
Redis.exists_returns_integer = nil(default setting),Redis#exists(key)returnsbooleanwith the above error message. I suspect that this is a bug.When this message was added, the version was prior to 4.3 (4.2.1).
So it would have returned the previous behavior (boolean) when
Redis.exists_returns_integer = nilorRedis.exists_returns_integer = false.However, now (or later) it returns the previous behavior (boolean) only when
Redis.exists_returns_integer = false, and not whenI think it should return
integerifRedis.exists_returns_integer = nil(default) orRedis.exists_returns_integer = true.Perhaps
Redis.exists_returns_booleanwill be more suitable and simpler for opt-in/opt-out applications.Actually, this is my first pull request, so I may have the wrong way to contribute!
Please let me know if I'm wrong.
Thank you!:blush: