Use Redis#mget for RedisCacheStore#fetch_multi
This commit is contained in:
parent
3b5d940fe5
commit
83c1ed9a1a
|
@ -307,6 +307,14 @@ module ActiveSupport
|
|||
end
|
||||
end
|
||||
|
||||
def read_multi_entries(names, _options)
|
||||
if mget_capable?
|
||||
read_multi_mget(*names)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def read_multi_mget(*names)
|
||||
options = names.extract_options!
|
||||
options = merged_options(options)
|
||||
|
|
|
@ -109,6 +109,14 @@ module ActiveSupport::Cache::RedisCacheStoreTests
|
|||
include CacheIncrementDecrementBehavior
|
||||
include CacheInstrumentationBehavior
|
||||
include AutoloadingCacheBehavior
|
||||
|
||||
def test_fetch_multi_uses_redis_mget
|
||||
assert_called(@cache.redis, :mget, returns: []) do
|
||||
@cache.fetch_multi("a", "b", "c") do |key|
|
||||
key * 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Separate test class so we can omit the namespace which causes expected,
|
||||
|
|
Loading…
Reference in New Issue