class HTTP::Cache

def handle_response(cached_resp, actual_resp, req)

updating the cache as appropriate
@returns [Response] the most useful of the responses after
def handle_response(cached_resp, actual_resp, req)
  if actual_resp.status.not_modified? && cached_resp
    logger.debug { "<#{req.uri}> not modified, using cached version." }
    cached_resp.validated!(actual_resp)
    store_in_cache(req, cached_resp)
    return cached_resp
  elsif req.cacheable? && actual_resp.cacheable?
    store_in_cache(req, actual_resp)
    return actual_resp
  else
    return actual_resp
  end
end