class Redis::Connection::Hiredis

def connect(host, port, timeout)

def connect(host, port, timeout)
  @connection.connect(host, port, timeout)
rescue Errno::ETIMEDOUT
  raise Timeout::Error
end

def connect_unix(path, timeout)

def connect_unix(path, timeout)
  @connection.connect_unix(path, timeout)
rescue Errno::ETIMEDOUT
  raise Timeout::Error
end

def connected?

def connected?
  @connection.connected?
end

def disconnect

def disconnect
  @connection.disconnect
end

def initialize

def initialize
  @connection = ::Hiredis::Connection.new
end

def read

def read
  reply = @connection.read
  reply = CommandError.new(reply.message) if reply.is_a?(RuntimeError)
  reply
rescue RuntimeError => err
  raise ProtocolError.new(err.message)
end

def timeout=(usecs)

def timeout=(usecs)
  @connection.timeout = usecs
end

def write(command)

def write(command)
  @connection.write(command.flatten(1))
end