Module: EM::Resque

Extended by:
Resque
Included in:
Resque
Defined in:
lib/em-resque.rb

Class Method Summary collapse

Class Method Details

.initialize_redis(server, namespace = :resque, pool_size = 1) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/em-resque.rb', line 10

def self.initialize_redis(server, namespace = :resque, pool_size = 1)
  case server
  when String
    redis = EventMachine::Synchrony::ConnectionPool.new(:size => pool_size) do
      EM::Hiredis.connect(server)
    end

    Resque.redis = Redis::Namespace.new(namespace, :redis => redis)
  when Redis::Namespace
    Resque.redis = server
  else
    redis = EventMachine::Synchrony::ConnectionPool.new(:size => pool_size) do
      server
    end
    Resque.redis = Redis::Namespace.new(namespace, :redis => redis)
  end
end