class TwitterFriendly::ASLogSubscriber

Public Instance Methods

cache_any(event) click to toggle source
# File lib/twitter_friendly/log_subscriber.rb, line 103
def cache_any(event)
  debug do
    payload = event.payload
    operation = payload[:super_operation] == :fetch ? :fetch : payload[:name]
    hit = %i(read fetch).include?(operation.to_sym) && payload[:hit] ? ' (Hit)' : ''
    name = "  AS::#{operation.capitalize}#{hit} #{payload[:key].split('__')[1]} (#{event.duration.round(1)}ms)"
    name = color(name, MAGENTA, true)
    # :name, :expires_in, :super_operation, :hit, :race_condition_ttl, :tf_super_operation, :tf_super_super_operation
    "#{name} #{(payload.slice(:key).inspect)}"
  end
end