Class: Wamp::Worker::Ticker
- Inherits:
-
Object
- Object
- Wamp::Worker::Ticker
- Defined in:
- lib/wamp/worker/ticker.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
-
#ticker_key ⇒ Object
readonly
Returns the value of attribute ticker_key.
Instance Method Summary collapse
-
#get ⇒ Int
Returns the tick for the worker.
-
#increment ⇒ Object
Increments the tick.
-
#initialize(name) ⇒ Ticker
constructor
Constructor.
Constructor Details
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
5 6 7 |
# File 'lib/wamp/worker/ticker.rb', line 5 def redis @redis end |
#ticker_key ⇒ Object (readonly)
Returns the value of attribute ticker_key.
5 6 7 |
# File 'lib/wamp/worker/ticker.rb', line 5 def ticker_key @ticker_key end |
Instance Method Details
#get ⇒ Int
Returns the tick for the worker
18 19 20 |
# File 'lib/wamp/worker/ticker.rb', line 18 def get self.redis.get(self.ticker_key) || 0 end |
#increment ⇒ Object
Increments the tick
24 25 26 |
# File 'lib/wamp/worker/ticker.rb', line 24 def increment self.redis.incr(self.ticker_key) end |