Module: EM::Redis

Defined in:
lib/em/redis.rb,
lib/em-synchrony/em-redislite.rb

Defined Under Namespace

Classes: Client, ConnectionError, DataError, Error

Constant Summary collapse

VERSION =
'0.2.2'
DEFAULTS =
{ host: '127.0.0.1', port: 6379 }

Class Method Summary collapse

Class Method Details

.connect(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/em/redis.rb', line 13

def self.connect options = {}
  options = DEFAULTS.merge(options)
  begin
    EM.connect options[:host], options[:port], Client, { host: options[:host], port: options[:port] }
  rescue EM::ConnectionError => e
    client = Client.new(nil)
    client.fail(Error.new(e.message))
    client
  end
end