1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

- Rename increment_or_decrement to an apt set_cache_value since it actually doesn't increment/decrement in localstore.

This commit is contained in:
Vipul A M 2014-03-24 19:41:43 +05:30
parent 8bd29122ec
commit ab6deeef9b

View file

@ -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