Add couchbase with modifications, formalize broadcaster and make testable and some other stuff
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user