class AdequateSerialization::Rails::CacheStep

Public Instance Methods

apply(response) click to toggle source
# File lib/adequate_serialization/rails/cache_step.rb, line 20
def apply(response)
  object = response.object
  opts = response.opts

  if opts.options[:multi_caching] || !CacheKey.cacheable?(object)
    return apply_next(response)
  end

  ::Rails.cache.fetch(CacheKey.for(object, opts.includes)) do
    apply_next(response)
  end
end