Sha256: ac244ead85ed1de32414ada1e8fbb15a21c7bbe3c71523fa56bab623841245ae

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 Bytes

Contents

require 'eventmachine'
require 'uri'

module EventMachine
  module Hiredis
    def self.setup(uri = nil)
      url = URI(uri || ENV["REDIS_URL"] || "redis://127.0.0.1:6379/0")
      Client.new(url.host, url.port, url.password, url.path[1..-1])
    end

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

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

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

require 'em-hiredis/event_emitter'
require 'em-hiredis/connection'
require 'em-hiredis/client'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-hiredis-0.1.1 lib/em-hiredis.rb
em-hiredis-0.1.0 lib/em-hiredis.rb