Skip to content

Commit 525a93e

Browse files
committed
Fix Redis#exists? to return boolean value for multiple key match.
1 parent 850ab84 commit 525a93e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/redis.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ def _exists(*keys)
584584
# @return [Boolean]
585585
def exists?(*keys)
586586
synchronize do |client|
587-
client.call([:exists, *keys], &Boolify)
587+
client.call([:exists, *keys]) do |value|
588+
value > 0
589+
end
588590
end
589591
end
590592

test/lint/value_types.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def test_exists?
4040
r.set("{1}foo", "s1")
4141

4242
assert_equal true, r.exists?("{1}foo")
43+
44+
r.set("{1}bar", "s1")
45+
46+
assert_equal true, r.exists?("{1}foo", "{1}bar")
4347
end
4448

4549
def test_type

0 commit comments

Comments
 (0)