aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMichael Grosser <michael@grosser.it>2015-11-05 17:35:50 -0800
committerMichael Grosser <michael@grosser.it>2015-11-06 08:27:33 -0800
commit2c42404330a3e7a1648a01e072035c2bee9cc118 (patch)
tree74b32b9e52a814b55813cfb46f50e327bdfb96aa /activesupport
parentcb67c819338d75c07a591dc23759747c740a5088 (diff)
downloadrails-2c42404330a3e7a1648a01e072035c2bee9cc118.tar.gz
rails-2c42404330a3e7a1648a01e072035c2bee9cc118.tar.bz2
rails-2c42404330a3e7a1648a01e072035c2bee9cc118.zip
call local_cache 1 time instead of 3 times
LocalCache read_entry previously called the local_cache method 3 times, now it only calls it once and keeps the result in a local variable.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache/strategy/local_cache.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb
index e1da2be2d4..4e2d3e9875 100644
--- a/activesupport/lib/active_support/cache/strategy/local_cache.rb
+++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb
@@ -102,10 +102,10 @@ module ActiveSupport
protected
def read_entry(key, options) # :nodoc:
- if local_cache
- local_cache.fetch(key) do
+ if cache = local_cache
+ cache.fetch(key) do
entry = super
- local_cache.write_entry(key, entry, options)
+ cache.write_entry(key, entry, options)
entry
end
else