Module: EventMachine::Hiredis

Defined in:
lib/em-hiredis.rb,
lib/em-hiredis/client.rb,
lib/em-hiredis/version.rb,
lib/em-hiredis/connection.rb,
lib/em-hiredis/base_client.rb,
lib/em-hiredis/event_emitter.rb,
lib/em-hiredis/pubsub_client.rb

Defined Under Namespace

Modules: EventEmitter Classes: BaseClient, Client, Connection, Error, PubsubClient

Constant Summary collapse

VERSION =
"0.1.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.reconnect_timeoutObject

Returns the value of attribute reconnect_timeout.



12
13
14
# File 'lib/em-hiredis.rb', line 12

def reconnect_timeout
  @reconnect_timeout
end

Class Method Details

.connect(uri = nil) ⇒ Object



23
24
25
26
27
# File 'lib/em-hiredis.rb', line 23

def self.connect(uri = nil)
  client = setup(uri)
  client.connect
  client
end

.loggerObject



33
34
35
36
37
38
39
40
# File 'lib/em-hiredis.rb', line 33

def self.logger
  @@logger ||= begin
    require 'logger'
    log = Logger.new(STDOUT)
    log.level = Logger::WARN
    log
  end
end

.logger=(logger) ⇒ Object



29
30
31
# File 'lib/em-hiredis.rb', line 29

def self.logger=(logger)
  @@logger = logger
end

.setup(uri = nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/em-hiredis.rb', line 16

def self.setup(uri = nil)
  uri = uri || ENV["REDIS_URL"] || "redis://127.0.0.1:6379/0"
  client = Client.new
  client.configure(uri)
  client
end