Sha256: 45b933c432fd80841cd583d8d8b6133dce5f25157ebd734ac51ee3f3b339b057
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require "redis/connection/registry" require "redis/errors" require "hiredis/connection" require "timeout" class Redis module Connection class Hiredis def initialize @connection = ::Hiredis::Connection.new end def connected? @connection.connected? end def timeout=(usecs) @connection.timeout = usecs end def connect(host, port, timeout) @connection.connect(host, port, timeout) rescue Errno::ETIMEDOUT raise Timeout::Error end def connect_unix(path, timeout) @connection.connect_unix(path, timeout) rescue Errno::ETIMEDOUT raise Timeout::Error end def disconnect @connection.disconnect end def write(command) @connection.write(command.flatten(1)) end 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 end end end Redis::Connection.drivers << Redis::Connection::Hiredis
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis-3.0.0.rc1 | lib/redis/connection/hiredis.rb |