module HTTPX::Plugins::ResponseCache::RequestMethods

  1. lib/httpx/plugins/response_cache.rb

Methods

Public Instance

  1. cacheable_verb?
  2. response_cache_key

Public Instance methods

cacheable_verb?()

returns whether this request is cacheable as per HTTP caching rules.

[show source]
    # File lib/httpx/plugins/response_cache.rb
148 def cacheable_verb?
149   CACHEABLE_VERBS.include?(@verb)
150 end
response_cache_key()

returns a unique cache key as a String identifying this request

[show source]
    # File lib/httpx/plugins/response_cache.rb
153 def response_cache_key
154   @response_cache_key ||= begin
155     keys = [@verb, @uri.merge(path)]
156 
157     @options.supported_vary_headers.each do |field|
158       value = @headers[field]
159 
160       keys << value if value
161     end
162     Digest::SHA1.hexdigest("httpx-response-cache-#{keys.join("-")}")
163   end
164 end