Class: Debugbar::ActiveSupportEventSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/debugbar/subscribers/active_support.rb

Class Method Summary collapse

Class Method Details

.cache(event) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/debugbar/subscribers/active_support.rb', line 4

def cache(event)
  evt = event.payload
  evt[:name] = event.name
  evt[:transaction_id] = event.transaction_id
  evt[:time] = Time.at(event.time).strftime(Debugbar::TIME_FORMAT)
  evt[:label] = case event.name
    when "cache_read.active_support"
      "read"
    when "cache_generate.active_support"
      "generate"
    when "cache_fetch_hit.active_support"
      "fetch hit"
    when "cache_write.active_support"
      "write"
    when "cache_delete.active_support"
      "delete"
    when "cache_exist?.active_support"
      "exist?"
    else
      "unknown"
    end

  Debugbar::Tracker.add_cache evt
end