### Home Classes Methods

### In Files

- lib/em-hiredis.rb
- lib/em-hiredis/base_client.rb
- lib/em-hiredis/pubsub_client.rb
- lib/em-hiredis/version.rb
- lib/em-hiredis/event_emitter.rb
- lib/em-hiredis/connection.rb
- lib/em-hiredis/client.rb

### Namespace

- MODULE EventMachine::Hiredis::EventEmitter
- CLASS EventMachine::Hiredis::BaseClient
- CLASS EventMachine::Hiredis::Client
- CLASS EventMachine::Hiredis::Connection
- CLASS EventMachine::Hiredis::Error
- CLASS EventMachine::Hiredis::PubsubClient
- CLASS EventMachine::Hiredis::RedisError

### Methods

- ::connect
- ::logger
- ::logger=
- ::setup

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine::Hiredis
- EventMachine::Hiredis::BaseClient
- EventMachine::Hiredis::Client
- EventMachine::Hiredis::Connection
- EventMachine::Hiredis::Error
- EventMachine::Hiredis::EventEmitter
- EventMachine::Hiredis::PubsubClient
- EventMachine::Hiredis::RedisError
- EM
- EM::Hiredis
- EM::Hiredis::Lock
- EM::Hiredis::PersistentLock

No matching classes.

# EventMachine::Hiredis

### Constants

VERSION

### Attributes

reconnect_timeout[RW]

### Public Class Methods

connect(uri = nil) click to toggle source

Connects to redis and returns a client instance

Will connect in preference order to the provided uri, the REDIS_URL environment variable, or localhost:6379

TCP connections are supported via redis://:password@host:port/db (only host and port components are required)

Unix socket uris are supported, e.g. unix:///tmp/redis.sock, however it's not possible to set the db or password - use initialize instead in this case

    # File lib/em-hiredis.rb, line 37
    def self.connect(uri = nil)
      client = setup(uri)
      client.connect
      client
    end

logger() click to toggle source

    # File lib/em-hiredis.rb, line 47
    def self.logger
      @@logger ||= begin
        require 'logger'
        log = Logger.new(STDOUT)
        log.level = Logger::WARN
        log
      end
    end

logger=(logger) click to toggle source

    # File lib/em-hiredis.rb, line 43
    def self.logger=(logger)
      @@logger = logger
    end

setup(uri = nil) click to toggle source

    # File lib/em-hiredis.rb, line 19
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.