28 lines
539 B
Ruby
28 lines
539 B
Ruby
module Qwaiter
|
|
module Counter
|
|
mattr_accessor :connection
|
|
|
|
# mainly for testing purposes
|
|
def self.set(key, value)
|
|
connection.set(key, value)
|
|
end
|
|
|
|
def self.get(key)
|
|
connection.get(key).to_i
|
|
end
|
|
|
|
def self.incr(*args)
|
|
connection.incr(*args)
|
|
end
|
|
|
|
def self.decr(*args)
|
|
connection.decr(*args)
|
|
end
|
|
end
|
|
end
|
|
|
|
# use the connection from couchbase-structures/documents
|
|
# will be overwritten in the specs since flushing the real
|
|
# thing is difficult
|
|
Qwaiter::Counter.connection = $cb
|