提交 5e216674 编写于 作者: D David Verhasselt

Redis fetch without names returns {}

When trying to call mget in Redis without any
parameters, a Redis error is thrown. To avoid
this, we circumvent Redis entirely when there
are no key names given.
上级 3bd53428
......@@ -361,6 +361,7 @@ def read_multi_entries(names, _options)
def read_multi_mget(*names)
options = names.extract_options!
options = merged_options(options)
return {} if names == []
keys = names.map { |name| normalize_key(name, options) }
......
......@@ -140,6 +140,12 @@ def test_fetch_multi_uses_redis_mget
end
end
def test_fetch_multi_without_names
assert_not_called(@cache.redis, :mget) do
@cache.fetch_multi() { }
end
end
def test_increment_expires_in
assert_called_with @cache.redis, :incrby, [ "#{@namespace}:foo", 1 ] do
assert_called_with @cache.redis, :expire, [ "#{@namespace}:foo", 60 ] do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册