1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #39844 from deepredsky/redis-cache-bug

Fix option not being passed with fetch_multi
This commit is contained in:
Eugene Kenny 2020-07-26 09:58:16 +01:00 committed by GitHub
commit e8dcb728ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,8 @@
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
to `read_multi` causing `fetch_multi` to not work properly
*Rajesh Sharma*
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
and caused the provided `compression_threshold` to not be respected.

View file

@ -351,7 +351,7 @@ module ActiveSupport
def read_multi_entries(names, **options)
if mget_capable?
read_multi_mget(*names)
read_multi_mget(*names, **options)
else
super
end

View file

@ -142,6 +142,14 @@ module ActiveSupport::Cache::RedisCacheStoreTests
end
end
def test_fetch_multi_with_namespace
assert_called_with(@cache.redis, :mget, ["custom-namespace:a", "custom-namespace:b", "custom-namespace:c"], returns: []) do
@cache.fetch_multi("a", "b", "c", namespace: "custom-namespace") do |key|
key * 2
end
end
end
def test_fetch_multi_without_names
assert_not_called(@cache.redis, :mget) do
@cache.fetch_multi() { }