class Wamp::Worker::Ticker
Attributes
redis[R]
ticker_key[R]
Public Class Methods
new(name)
click to toggle source
Constructor
@param name [Symbol] - The name of the worker
# File lib/wamp/worker/ticker.rb, line 10 def initialize(name) @redis = Wamp::Worker.config.redis(name) @ticker_key = "wamp:#{name}:tick" end
Public Instance Methods
get()
click to toggle source
Returns the tick for the worker
@return [Int] - The value of the tick
# File lib/wamp/worker/ticker.rb, line 18 def get self.redis.get(self.ticker_key) || 0 end
increment()
click to toggle source
Increments the tick
# File lib/wamp/worker/ticker.rb, line 24 def increment self.redis.incr(self.ticker_key) end