Object
# File lib/redis/connection/synchrony.rb, line 68 def self.connect(config) if config[:scheme] == "unix" conn = EventMachine.connect_unix_domain(config[:path], RedisClient) else conn = EventMachine.connect(config[:host], config[:port], RedisClient) do |c| c.pending_connect_timeout = [config[:timeout], 0.1].max end end fiber = Fiber.current conn.callback { fiber.resume } conn.errback { fiber.resume :refused } raise Errno::ECONNREFUSED if Fiber.yield == :refused instance = new(conn) instance.timeout = config[:timeout] instance end
# File lib/redis/connection/synchrony.rb, line 92 def connected? @connection && @connection.connected? end
# File lib/redis/connection/synchrony.rb, line 100 def disconnect @connection.close_connection @connection = nil end
# File lib/redis/connection/synchrony.rb, line 109 def read type, payload = @connection.read if type == :reply payload elsif type == :error raise payload else raise "Unknown type #{type.inspect}" end end
Generated with the Darkfish Rdoc Generator 2.