Sha256: 7e4cf46f934ca4568f5abcdc72f78c0d0647aba5e6f26db2f9653afe292f4929

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'eventmachine'

module EventMachine
  module Hiredis
    class Error < RuntimeError
      # In the case of error responses from Redis, the RuntimeError returned
      # by ::Hiredis will be wrapped
      attr_accessor :redis_error
    end

    class << self
      attr_accessor :reconnect_timeout
    end
    self.reconnect_timeout = 0.5

    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

    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/base_client'
require 'em-hiredis/client'
require 'em-hiredis/pubsub_client'
require 'em-hiredis/lock'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cs-em-hiredis-0.1.2 lib/em-hiredis.rb