From ab6deeef9bfcd52e364ef83e01be1127121accd9 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Mon, 24 Mar 2014 19:41:43 +0530 Subject: [PATCH] - Rename `increment_or_decrement` to an apt `set_cache_value` since it actually doesn't increment/decrement in localstore. --- .../lib/active_support/cache/strategy/local_cache.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index 6afb07bd72..e9ee98a128 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -85,13 +85,13 @@ module ActiveSupport def increment(name, amount = 1, options = nil) # :nodoc: value = bypass_local_cache{super} - increment_or_decrement(value, name, amount, options) + set_cache_value(value, name, amount, options) value end def decrement(name, amount = 1, options = nil) # :nodoc: value = bypass_local_cache{super} - increment_or_decrement(value, name, amount, options) + set_cache_value(value, name, amount, options) value end @@ -119,8 +119,7 @@ module ActiveSupport super end - private - def increment_or_decrement(value, name, amount, options) + def set_cache_value(value, name, amount, options) if local_cache local_cache.mute do if value @@ -132,6 +131,8 @@ module ActiveSupport end end + private + def local_cache_key @local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, '_').to_sym end