Method: Redis::Commands::Server#client

Defined in:
lib/redis/commands/server.rb

#client(subcommand, *args) ⇒ String, Hash

Manage client connections.

Parameters:

  • subcommand (String, Symbol)

    e.g. ‘kill`, `list`, `getname`, `setname`

Returns:

  • (String, Hash)

    depends on subcommand



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/redis/commands/server.rb', line 39

def client(subcommand, *args)
  send_command([:client, subcommand] + args) do |reply|
    if subcommand.to_s == "list"
      reply.lines.map do |line|
        entries = line.chomp.split(/[ =]/)
        Hash[entries.each_slice(2).to_a]
      end
    else
      reply
    end
  end
end