Sha256: 88c0772cc338c204ad3f4f78637cba4b6e8c6b723e6d0351e5e03efbfad5d4c1

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 Bytes

Contents

module Cacheflow
  module Memcached
    module Notifications
      def request(op, *args)
        payload = {
          op: op,
          args: args
        }
        ActiveSupport::Notifications.instrument("query.memcached", payload) do
          super
        end
      end
    end

    class Instrumenter < ActiveSupport::LogSubscriber
      def query(event)
        return if !logger.debug? || Cacheflow.silenced?

        name = "%s (%.2fms)" % ["Memcached", event.duration]
        debug "  #{color(name, BLUE, true)} #{event.payload[:op].to_s.upcase} #{event.payload[:args].join(" ")}"
      end
    end
  end
end

Dalli::Server.prepend(Cacheflow::Memcached::Notifications)
Cacheflow::Memcached::Instrumenter.attach_to(:memcached)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cacheflow-0.2.0 lib/cacheflow/memcached.rb
cacheflow-0.1.1 lib/cacheflow/memcached.rb