class RedisHA::Counter
Constants
- DEFAULT_MERGE_STRATEGY
this lambda defines how the individual response hashes are merged the default is to select the maximum value
Public Instance Methods
decr(n = 1)
click to toggle source
# File lib/redis_ha/crdt/counter.rb, line 12 def decr(n = 1) pool.decrby(@key, n) true end
get()
click to toggle source
# File lib/redis_ha/crdt/counter.rb, line 22 def get versions = pool.get(@key).compact merge_strategy[versions].to_i end
incr(n = 1)
click to toggle source
# File lib/redis_ha/crdt/counter.rb, line 7 def incr(n = 1) pool.incrby(@key, n) true end
merge_strategy()
click to toggle source
# File lib/redis_ha/crdt/counter.rb, line 27 def merge_strategy @merge_strategy || DEFAULT_MERGE_STRATEGY end
set(n)
click to toggle source
# File lib/redis_ha/crdt/counter.rb, line 17 def set(n) pool.set(@key, n) true end