Method: Redis::Commands::Server#monitor

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

#monitor {|line| ... } ⇒ Object

Listen for all requests received by the server in real time.

There is no way to interrupt this command.

Yields:

  • a block to be called for every line of output

Yield Parameters:

  • line (String)

    timestamp and command that was executed



120
121
122
123
124
125
126
127
128
# File 'lib/redis/commands/server.rb', line 120

def monitor
  synchronize do |client|
    client = client.pubsub
    client.call_v([:monitor])
    loop do
      yield client.next_event
    end
  end
end