In the Redis documentation for exists, as of Redis 3.0.3 exists may take multiple key names and returns a count of the number of keys that exist.
Using the redis-rb gem v3.3.3, the result of Redis::exists with an array of keys returns true if and only if just one of the keys exist. false is returned if none of the keys exist or if multiple keys do because Boolify looks for a non-nil value equal to 1.
To reproduce:
r = Redis.new
r.mset 'test1', 1, 'test2', 2
r.exists ['test1', 'nonexistant']
#=> true
r.exists ['test1', 'test2']
#=> false
So either Boolify could be adjusted to look for values >= 1, or (what makes more sense to me) Boolify should not be used in this function so that the return value is the count of the number of keys found as is described in the Redis docs.
In the Redis documentation for
exists, as of Redis 3.0.3existsmay take multiple key names and returns a count of the number of keys that exist.Using the
redis-rbgem v3.3.3, the result ofRedis::existswith an array of keys returnstrueif and only if just one of the keys exist.falseis returned if none of the keys exist or if multiple keys do becauseBoolifylooks for a non-nil value equal to 1.To reproduce:
So either
Boolifycould be adjusted to look for values>= 1, or (what makes more sense to me)Boolifyshould not be used in this function so that the return value is the count of the number of keys found as is described in the Redis docs.