lib/cacheable/controller.rb
def response_cache(key_data=nil, version_data=nil, &block)
      cacheable_req = cacheable_request?
      unless cache_configured? && cacheable_req
        Cacheable.log("Uncacheable request. cache_configured='#{!!cache_configured?}' cacheable_request='#{cacheable_req}' params_cache='#{request.params[:cache] != 'false'}'")
        response.headers['Cache-Control'.freeze] = 'no-cache, no-store'.freeze unless cacheable_req
        return yield
      end

      handler = Cacheable::ResponseCacheHandler.new(self) do |h|
        h.key_data       = key_data       || cache_key_data
        h.version_data   = version_data   || cache_version_data
        h.block          = block
        h.cache_store    = Cacheable.cache_store
      end

      handler.run!
    end
# Only get? and head? requests should be cacheable
Only get. and head. requests should be cacheable
Only get . and head . requests should be cacheable
def response_cache(key_data=nil, version_data=nil, &block)
      cacheable_req = cacheable_request?
      unless cache_configured? && cacheable_req
        Cacheable.log("Uncacheable request. cache_configured='#{!!cache_configured?}' cacheable_request='#{cacheable_req}' params_cache='#{request.params[:cache] != 'false'}'")
        response.headers['Cache-Control'.freeze] = 'no-cache, no-store'.freeze unless cacheable_req
        return yield
      end
      handler = Cacheable::ResponseCacheHandler.new(self) do |h|
        h.key_data       = key_data       || cache_key_data
        h.version_data   = version_data   || cache_version_data
        h.block          = block
        h.cache_store    = Cacheable.cache_store
      end
      handler.run!
    end
def response_cache ( key_data = nil , version_data = nil , & block ) cacheable_req = cacheable_request? unless cache_configured? && cacheable_req Cacheable . log ( "Uncacheable request. cache_configured='#{!!cache_configured?}' cacheable_request='#{cacheable_req}' params_cache='#{request.params[:cache] != 'false'}'" ) response . headers [ 'Cache-Control' . freeze ] = 'no-cache, no-store' . freeze unless cacheable_req return yield end handler = Cacheable :: ResponseCacheHandler . new ( self ) do | h | h . key_data = key_data || cache_key_data h . version_data = version_data || cache_version_data h . block = block h . cache_store = Cacheable . cache_store end handler . run! end
Only get?
Only get?
key_data
version_data
block