Fix and implement supplier counters
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
module Qwaiter
|
||||
module Couchbase
|
||||
def self.connection
|
||||
$cb
|
||||
end
|
||||
|
||||
def self.load_design_docs!
|
||||
Dir.glob(Rails.root.join('config/couchbase/design_docs', "*.json")).each do |design_doc|
|
||||
connection.save_design_doc File.open(design_doc)
|
||||
end
|
||||
end
|
||||
|
||||
def self.design_doc(name)
|
||||
connection.design_docs[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -8,15 +8,16 @@ module Qwaiter
|
||||
end
|
||||
|
||||
def self.get(key)
|
||||
connection.get(key).to_i
|
||||
connection.get(key, quiet: true).to_i
|
||||
end
|
||||
|
||||
def self.incr(*args)
|
||||
connection.incr(*args)
|
||||
def self.incr(key, options = {})
|
||||
options[:initial] ||= 0
|
||||
connection.incr(key, options)
|
||||
end
|
||||
|
||||
def self.decr(*args)
|
||||
connection.decr(*args)
|
||||
def self.decr(key, options = {})
|
||||
connection.decr(key, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user