stability improvement
This commit is contained in:
@@ -18,13 +18,23 @@ class InMemoryQCounter
|
||||
end
|
||||
|
||||
def incr(key, options = {})
|
||||
store[key] ||= options[:initial].to_i
|
||||
store[key] += 1
|
||||
# store[key] ||= options[:initial].to_i
|
||||
# store[key] += 1
|
||||
if store[key]
|
||||
store[key] += 1
|
||||
else
|
||||
store[key] = options[:initial].to_i
|
||||
end
|
||||
end
|
||||
|
||||
def decr(key, options = {})
|
||||
store[key] ||= options[:initial].to_i
|
||||
store[key] -= 1
|
||||
# store[key] ||= options[:initial].to_i
|
||||
# store[key] -= 1
|
||||
if store[key]
|
||||
store[key] -= 1
|
||||
else
|
||||
store[key] = options[:initial].to_i
|
||||
end
|
||||
end
|
||||
|
||||
def flush
|
||||
|
||||
Reference in New Issue
Block a user