Sha256: d8f6e63d9cfef9362522590f5508d28dc2f192f38a3d8a18e096380ce448bcda
Contents?: true
Size: 1.01 KB
Versions: 15
Compression:
Stored size: 1.01 KB
Contents
module Rack::Insight class CachePanel < Panel require "rack/insight/panels/cache_panel/panel_app" require "rack/insight/panels/cache_panel/stats" def request_start(env, start) @stats = Stats.new end def request_finish(env, st, hd, bd, timing) store(env, @stats) end def after_detect(method_call, timing, args, result) method, key = method_call.method, args.first if(defined? Dalli and Dalli::Client === method_call.object) method, key = args[0], args[1] end logger.info{ "Cache panel got #{method} #{key.inspect}" } if verbose(:high) @stats.record_call(method, timing.duration, !result.nil?, key) end def panel_app PanelApp.new end def heading_for_request(number) stats = retrieve(number).first "Cache: %.2fms (#{stats.queries.size} calls)" % stats.time end def content_for_request(number) stats = retrieve(number).first render_template "panels/cache", :stats => stats end end end
Version data entries
15 entries across 15 versions & 1 rubygems