diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-07-15 21:57:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-15 21:57:20 +0100 |
commit | f30f76af747858826d3618866676cd5a4979e64a (patch) | |
tree | ef01a081fd44ab0f9733bcb46a116808b0f5771a /activesupport/lib | |
parent | bcbe3dc6108704769d660fb6fd56b70d1ae77092 (diff) | |
parent | f08bf726d3038f062dd7485614d1ea85d952f121 (diff) | |
download | rails-f30f76af747858826d3618866676cd5a4979e64a.tar.gz rails-f30f76af747858826d3618866676cd5a4979e64a.tar.bz2 rails-f30f76af747858826d3618866676cd5a4979e64a.zip |
Merge pull request #36656 from Edouard-chin/ec-local-cache-reference
Return a copy of the cache entry when local_cache exists:
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache/strategy/local_cache.rb | 5 |
1 files changed, 4 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 67c455771e..8e80946fbb 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -74,7 +74,10 @@ module ActiveSupport end def fetch_entry(key, options = nil) # :nodoc: - @data.fetch(key) { @data[key] = yield } + entry = @data.fetch(key) { @data[key] = yield } + dup_entry = entry.dup + dup_entry&.dup_value! + dup_entry end end |