diff options
author | Jason Lee <huacnlee@gmail.com> | 2018-03-21 14:16:00 +0800 |
---|---|---|
committer | Jason Lee <huacnlee@gmail.com> | 2018-03-21 14:16:00 +0800 |
commit | 4e13a364a67e02ed0b3b8f69bac84d69632f58f6 (patch) | |
tree | da4aec84d75b3859df9400efb963aa9afaea218e /activesupport/lib/active_support/cache | |
parent | fab6ded8f299d51593f4d68f4f9b7b03b44aa2c3 (diff) | |
download | rails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.tar.gz rails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.tar.bz2 rails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.zip |
Fix Cache `read_multi` with local_cache return values.
It should returns raw value, not instance of `ActiveSupport::Cache::Entry`.
Diffstat (limited to 'activesupport/lib/active_support/cache')
-rw-r--r-- | activesupport/lib/active_support/cache/strategy/local_cache.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index e17308f83e..39b32fc7f6 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -55,7 +55,14 @@ module ActiveSupport end def read_multi_entries(keys, options) - Hash[keys.map { |name| [name, read_entry(name, options)] }.keep_if { |_name, value| value }] + values = {} + + keys.each do |name| + entry = read_entry(name, options) + values[name] = entry.value if entry + end + + values end def write_entry(key, value, options) |