Sha256: 6322ee2f31522d234cbe1641022ddcaa9218f12e0fede8a60ac18e68e8a4d06d
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
module Cacheflow module Redis module Notifications def logging(commands) payload = { commands: commands } ActiveSupport::Notifications.instrument("query.redis", payload) do super end end end class Instrumenter < ActiveSupport::LogSubscriber def query(event) return unless logger.debug? 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 end end end Redis::Client.prepend(Cacheflow::Redis::Notifications) Cacheflow::Redis::Instrumenter.attach_to(:redis)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cacheflow-0.1.0 | lib/cacheflow/redis.rb |