diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index 0b2e0d78687..c89cacdd61d 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -123,6 +123,9 @@ module ActiveSupport return super unless local_cache local_entries = local_cache.read_multi_entries(keys) + local_entries.transform_values! do |payload| + deserialize_entry(payload).value + end missed_keys = keys - local_entries.keys if missed_keys.any? diff --git a/activesupport/test/cache/behaviors/local_cache_behavior.rb b/activesupport/test/cache/behaviors/local_cache_behavior.rb index 968fde93c72..c68e0b6d0d0 100644 --- a/activesupport/test/cache/behaviors/local_cache_behavior.rb +++ b/activesupport/test/cache/behaviors/local_cache_behavior.rb @@ -286,4 +286,13 @@ module LocalCacheBehavior assert_equal false, @cache.read(key) end end + + def test_local_cache_should_deserialize_entries_on_multi_get + keys = Array.new(5) { SecureRandom.uuid } + values = keys.index_with(true) + @cache.with_local_cache do + assert @cache.write_multi(values) + assert_equal values, @cache.read_multi(*keys) + end + end end