diff options
author | Vipul A M <vipulnsward@gmail.com> | 2014-03-24 19:41:43 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2014-03-24 22:11:23 +0530 |
commit | ab6deeef9bfcd52e364ef83e01be1127121accd9 (patch) | |
tree | c5fcde8ede7f84ea67d24f0da231341479d46129 /activesupport/lib/active_support/cache | |
parent | 8bd29122ec4e8f7e3e42ee4fe3a5b203780c3fe1 (diff) | |
download | rails-ab6deeef9bfcd52e364ef83e01be1127121accd9.tar.gz rails-ab6deeef9bfcd52e364ef83e01be1127121accd9.tar.bz2 rails-ab6deeef9bfcd52e364ef83e01be1127121accd9.zip |
- Rename `increment_or_decrement` to an apt `set_cache_value` since it actually doesn't increment/decrement in localstore.
Diffstat (limited to 'activesupport/lib/active_support/cache')
-rw-r--r-- | activesupport/lib/active_support/cache/strategy/local_cache.rb | 9 |
1 files 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 |