Module: HTTPX::Plugins::ResponseCache::RequestMethods
- Defined in:
- lib/httpx/plugins/response_cache.rb
Instance Method Summary collapse
-
#cacheable_verb? ⇒ Boolean
returns whether this request is cacheable as per HTTP caching rules.
-
#response_cache_key ⇒ Object
returns a unique cache key as a String identifying this request.
Instance Method Details
#cacheable_verb? ⇒ Boolean
returns whether this request is cacheable as per HTTP caching rules.
148 149 150 |
# File 'lib/httpx/plugins/response_cache.rb', line 148 def cacheable_verb? CACHEABLE_VERBS.include?(@verb) end |
#response_cache_key ⇒ Object
returns a unique cache key as a String identifying this request
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/httpx/plugins/response_cache.rb', line 153 def response_cache_key @response_cache_key ||= begin keys = [@verb, @uri.merge(path)] @options.supported_vary_headers.each do |field| value = @headers[field] keys << value if value end Digest::SHA1.hexdigest("httpx-response-cache-#{keys.join("-")}") end end |