Skip to content

Commit

Permalink
Merge pull request #14466 from vipulnsward/rename-cache-method
Browse files Browse the repository at this point in the history
Rename method and stop passing unused arguements.
  • Loading branch information
rafaelfranca committed Mar 25, 2014
2 parents 416099c + ab6deee commit e209723
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -85,13 +85,13 @@ def cleanup(options = nil) # :nodoc:


def increment(name, amount = 1, options = nil) # :nodoc: def increment(name, amount = 1, options = nil) # :nodoc:
value = bypass_local_cache{super} value = bypass_local_cache{super}
increment_or_decrement(value, name, amount, options) set_cache_value(value, name, amount, options)
value value
end end


def decrement(name, amount = 1, options = nil) # :nodoc: def decrement(name, amount = 1, options = nil) # :nodoc:
value = bypass_local_cache{super} value = bypass_local_cache{super}
increment_or_decrement(value, name, amount, options) set_cache_value(value, name, amount, options)
value value
end end


Expand Down Expand Up @@ -119,8 +119,7 @@ def delete_entry(key, options) # :nodoc:
super super
end end


private def set_cache_value(value, name, amount, options)
def increment_or_decrement(value, name, amount, options)
if local_cache if local_cache
local_cache.mute do local_cache.mute do
if value if value
Expand All @@ -132,6 +131,8 @@ def increment_or_decrement(value, name, amount, options)
end end
end end


private

def local_cache_key def local_cache_key
@local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, '_').to_sym @local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, '_').to_sym
end end
Expand Down

0 comments on commit e209723

Please sign in to comment.