Add couchbase with modifications, formalize broadcaster and make testable and some other stuff

This commit is contained in:
2014-03-06 18:08:39 +01:00
parent 3f117c76b0
commit 0e7a39b819
28 changed files with 456 additions and 35 deletions
+29
View File
@@ -0,0 +1,29 @@
# This is a non thread safe replacement for the
# couchbase counter mechanism since every test needs
# a clean start and Hash#clear is soooo much faster than
# a couchbase bucket flush
class InMemoryQCounter
STORE = {}
def get(key)
STORE[key]
end
def set(key, value)
STORE[key] = value
end
def incr(key, options = {})
STORE[key] ||= options[:initial].to_i
STORE[key] += 1
end
def decr(key, options = {})
STORE[key] ||= options[:initial].to_i
STORE[key] -= 1
end
def flush
STORE.clear
end
end