Module: RedisHA::Router

Defined in:
lib/redis_ha/router.rb,
lib/redis_ha/router/upstream.rb,
lib/redis_ha/router/connection.rb

Defined Under Namespace

Classes: Connection, Upstream

Class Method Summary collapse

Class Method Details

.start(host, port, options = {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/redis_ha/router.rb', line 10

def self.start host, port, options={}, &block
  EM.epoll
  EM.run do
    trap("TERM") { stop }
    trap("INT")  { stop }

    EventMachine::start_server(host, port, RedisHA::Router::Connection, options[:debug]) do |serv|
      serv.instance_eval &block
    end
  end
end

.stopObject



22
23
24
# File 'lib/redis_ha/router.rb', line 22

def self.stop
  EventMachine.stop
end