From 2c42404330a3e7a1648a01e072035c2bee9cc118 Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Thu, 5 Nov 2015 17:35:50 -0800 Subject: 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. --- activesupport/lib/active_support/cache/strategy/local_cache.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport') 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 -- cgit v1.2.3