Class: Airbrush::Listeners::Memcache
- Defined in:
- lib/airbrush/listeners/memcache.rb
Constant Summary collapse
- DEFAULT_POLL_FREQUENCY =
seconds
2
- DEFAULT_INCOMING_QUEUE =
'airbrush_incoming_queue'
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#poll_frequency ⇒ Object
readonly
Returns the value of attribute poll_frequency.
Attributes inherited from Listener
Instance Method Summary collapse
-
#initialize(host, frequency = DEFAULT_POLL_FREQUENCY) ⇒ Memcache
constructor
A new instance of Memcache.
- #start ⇒ Object
Constructor Details
#initialize(host, frequency = DEFAULT_POLL_FREQUENCY) ⇒ Memcache
Returns a new instance of Memcache.
11 12 13 14 15 |
# File 'lib/airbrush/listeners/memcache.rb', line 11 def initialize(host, frequency = DEFAULT_POLL_FREQUENCY) @host = host @poll_frequency = frequency catch_signals(:int) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/airbrush/listeners/memcache.rb', line 9 def host @host end |
#poll_frequency ⇒ Object (readonly)
Returns the value of attribute poll_frequency.
9 10 11 |
# File 'lib/airbrush/listeners/memcache.rb', line 9 def poll_frequency @poll_frequency end |
Instance Method Details
#start ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/airbrush/listeners/memcache.rb', line 17 def start @running = true @starling = MemCache.new(@host) log.debug 'Accepting incoming jobs' loop do poll do |operation| process operation end break unless @running sleep @poll_frequency end @starling.reset end |