Object
# File lib/redis/connection/hiredis.rb, line 10 def self.connect(config) connection = ::Hiredis::Connection.new if config[:scheme] == "unix" connection.connect_unix(config[:path], Integer(config[:timeout] * 1_000_000)) else connection.connect(config[:host], config[:port], Integer(config[:timeout] * 1_000_000)) end instance = new(connection) instance.timeout = config[:timeout] instance rescue Errno::ETIMEDOUT raise TimeoutError end
# File lib/redis/connection/hiredis.rb, line 30 def connected? @connection && @connection.connected? end
# File lib/redis/connection/hiredis.rb, line 39 def disconnect @connection.disconnect @connection = nil end
# File lib/redis/connection/hiredis.rb, line 50 def read reply = @connection.read reply = CommandError.new(reply.message) if reply.is_a?(RuntimeError) reply rescue Errno::EAGAIN raise TimeoutError rescue RuntimeError => err raise ProtocolError.new(err.message) end
Generated with the Darkfish Rdoc Generator 2.