class RedisRds::Counter
Constants
- RING_INCREMENT_SCRIPT
Disable warning since one cannot freeze multiline heredocs… rubocop: disable Style/MutableConstant
Public Instance Methods
incrby(increment, max: nil)
click to toggle source
Calls superclass method
RedisRds::String#incrby
# File lib/redis_rds/counter.rb, line 17 def incrby(increment, max: nil) value = if max.nil? super(increment) else ring_increment_script(increment.to_i, max.to_i).to_i end return value end
Private Instance Methods
ring_increment_script(increment, max)
click to toggle source
# File lib/redis_rds/counter.rb, line 27 def ring_increment_script(increment, max) return connection.eval(RING_INCREMENT_SCRIPT, [@redis_key], [increment, max]) end