Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix LocalCache#read_multi_entries #44366

Merged
merged 1 commit into from Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -123,6 +123,9 @@ def read_multi_entries(keys, **options)
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?
Expand Down
9 changes: 9 additions & 0 deletions activesupport/test/cache/behaviors/local_cache_behavior.rb
Expand Up @@ -286,4 +286,13 @@ def test_local_cache_should_read_and_write_false
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