stability improvement

This commit is contained in:
2014-07-28 17:33:40 +02:00
parent 48e1850200
commit 7443d3b08b
12 changed files with 67 additions and 14 deletions
+14 -4
View File
@@ -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