Created
May 16, 2012 01:39
-
-
Save dpick/2706625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Redis | |
module Connection | |
class Logging < Redis::Connection::Ruby | |
def initialize(*args) | |
@command_queue = [] | |
super | |
end | |
def write(*args) | |
@command_queue << [args, Time.now] | |
super | |
end | |
def read(*args) | |
command = @command_queue.shift | |
puts "Read command #{command.first.inspect}, it took #{Time.now - command.last}" | |
super | |
end | |
end | |
end | |
end | |
Redis::Connection.drivers << Redis::Connection::Logging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment