class UnionStationHooksRails::ActiveSupportCacheSubscriber

Public Instance Methods

cache_fetch_hit(event) click to toggle source
# File lib/union_station_hooks_rails/active_support_cache_subscriber.rb, line 39
def cache_fetch_hit(event)
  reporter = Thread.current[:union_station_hooks]
  return if !reporter

  UnionStationHooks.call_event_pre_hook(event)
  reporter.log_cache_hit(event.payload[:key])
end
cache_generate(event) click to toggle source
# File lib/union_station_hooks_rails/active_support_cache_subscriber.rb, line 47
def cache_generate(event)
  reporter = Thread.current[:union_station_hooks]
  return if !reporter

  UnionStationHooks.call_event_pre_hook(event)
  reporter.log_cache_miss(event.payload[:key],
    (event.duration * 1_000_000).to_i)
end
cache_read(event) click to toggle source
# File lib/union_station_hooks_rails/active_support_cache_subscriber.rb, line 27
def cache_read(event)
  reporter = Thread.current[:union_station_hooks]
  return if !reporter

  UnionStationHooks.call_event_pre_hook(event)
  if event.payload[:hit]
    reporter.log_cache_hit(event.payload[:key])
  else
    reporter.log_cache_miss(event.payload[:key])
  end
end