lib/liberty_buildpack/util/cache/download_cache.rb
def request(uri, cached_file)
          request = Net::HTTP::Get.new(uri.request_uri)

          if cached_file.etag?
            cached_file.etag(File::RDONLY | File::BINARY) { |f| request['If-None-Match'] = File.read(f) }
          end

          if cached_file.last_modified?
            cached_file.last_modified(File::RDONLY | File::BINARY) { |f| request['If-Modified-Since'] = File.read(f) }
          end

          add_user_agent_header(request)

          @logger.debug { "Request: #{request.path}, #{request.to_hash}" }
          request
        end
# Creates an instance of the cache that is backed by a number of filesystem locations.  The first argument
# (+mutable_cache_root+) is the only location that downloaded files will be stored in.
#
# @param [Pathname] mutable_cache_root the filesystem location in which find cached files in.  This will also be
#                                      the location that all downloaded files are written to.
# @param [Pathname] immutable_cache_roots other filesystem locations to find cached files in.  No files will be
#                                         written to these locations.
Creates an instance of the cache that is backed by a number of filesystem locations.  The first argument
(+mutable_cache_root+) is the only location that downloaded files will be stored in.
Creates an instance of the cache that is backed by a number of filesystem locations . The first argument ( + mutable_cache_root + ) is the only location that downloaded files will be stored in .
def request(uri, cached_file)
          request = Net::HTTP::Get.new(uri.request_uri)
          if cached_file.etag?
            cached_file.etag(File::RDONLY | File::BINARY) { |f| request['If-None-Match'] = File.read(f) }
          end
          if cached_file.last_modified?
            cached_file.last_modified(File::RDONLY | File::BINARY) { |f| request['If-Modified-Since'] = File.read(f) }
          end
          add_user_agent_header(request)
          @logger.debug { "Request: #{request.path}, #{request.to_hash}" }
          request
        end
def request ( uri , cached_file ) request = Net :: HTTP :: Get . new ( uri . request_uri ) if cached_file . etag? cached_file . etag ( File :: RDONLY | File :: BINARY ) { | f | request [ 'If-None-Match' ] = File . read ( f ) } end if cached_file . last_modified? cached_file . last_modified ( File :: RDONLY | File :: BINARY ) { | f | request [ 'If-Modified-Since' ] = File . read ( f ) } end add_user_agent_header ( request ) @logger . debug { "Request: #{request.path}, #{request.to_hash}" } request end
Creates an instance of the cache that is backed by a number of filesystem locations.
Creates an instance of the cache that is backed by a number of filesystem locations .
uri
cached_file
immutable_cache_roots other filesystem locations to find cached files in. No files will be written to these locations.
immutable_cache_roots other filesystem locations to find cached files in . No files will be written to these locations .