rename qwaiter to mozo
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
module Mozo
|
||||
module Counter
|
||||
mattr_accessor :connection
|
||||
|
||||
# mainly for testing purposes
|
||||
def self.set(key, value)
|
||||
connection.set(key, value) rescue value
|
||||
end
|
||||
|
||||
def self.get(key)
|
||||
connection.get(key, quiet: true).to_i rescue 0
|
||||
end
|
||||
|
||||
def self.incr(key, options = {})
|
||||
options[:initial] ||= 1
|
||||
connection.incr(key, options) rescue 1
|
||||
end
|
||||
|
||||
def self.decr(key, options = {})
|
||||
options[:initial] ||= 0
|
||||
connection.decr(key, options) rescue 0
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user