class Redis::Client
def raw_call_command(argvp)
def raw_call_command(argvp) if argvp[0].is_a?(Array) argvv = argvp pipeline = true else argvv = [argvp] pipeline = false end if @binary_keys or pipeline or MULTI_BULK_COMMANDS[argvv[0][0].to_s] command = "" argvv.each do |argv| command << "*#{argv.size}\r\n" argv.each{|a| a = a.to_s command << "$#{get_size(a)}\r\n" command << a command << "\r\n" } end else command = "" argvv.each do |argv| bulk = nil argv[0] = argv[0].to_s if ALIASES[argv[0]] deprecated(argv[0], ALIASES[argv[0]], caller[4]) argv[0] = ALIASES[argv[0]] end raise "#{argv[0]} command is disabled" if DISABLED_COMMANDS[argv[0]] if BULK_COMMANDS[argv[0]] and argv.length > 1 bulk = argv[-1].to_s argv[-1] = get_size(bulk) end command << "#{argv.join(' ')}\r\n" command << "#{bulk}\r\n" if bulk end end # When in Pub/Sub mode we don't read replies synchronously. if @pubsub @sock.write(command) return true end # The normal command execution is reading and processing the reply. results = maybe_lock do begin set_socket_timeout!(0) if requires_timeout_reset?(argvv[0][0].to_s) process_command(command, argvv) ensure set_socket_timeout!(@timeout) if requires_timeout_reset?(argvv[0][0].to_s) end end return pipeline ? results : results[0] end