Class: Cacheflow::Redis::Instrumenter

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/cacheflow/redis.rb

Instance Method Summary collapse

Instance Method Details

#query(event) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cacheflow/redis.rb', line 15

def query(event)
  return if !logger.debug? || Cacheflow.silenced?

  name = "%s (%.2fms)" % ["Redis", event.duration]

  commands = []
  event.payload[:commands].map do |op, *args|
    commands << "#{op.to_s.upcase} #{args.join(" ")}".strip
  end

  debug "  #{color(name, RED, true)} #{commands.join(" >> ")}"
end