Skip to content
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 Redis#exists? to return boolean value for multiple key match. #918

Merged
merged 1 commit into from Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/redis.rb
Expand Up @@ -584,7 +584,9 @@ def _exists(*keys)
# @return [Boolean]
def exists?(*keys)
synchronize do |client|
client.call([:exists, *keys], &Boolify)
client.call([:exists, *keys]) do |value|
value > 0
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/lint/value_types.rb
Expand Up @@ -40,6 +40,10 @@ def test_exists?
r.set("{1}foo", "s1")

assert_equal true, r.exists?("{1}foo")

r.set("{1}bar", "s1")

assert_equal true, r.exists?("{1}foo", "{1}bar")
end

def test_type
Expand Down