Module: HTTPX::Plugins::ResponseCache::RequestMethods
- Defined in:
- lib/httpx/plugins/response_cache.rb,
sig/plugins/response_cache.rbs
Instance Attribute Summary collapse
-
#cached_response ⇒ responseCacheResponse?
Returns the value of attribute cached_response.
-
#options ⇒ responseCacheOptions
readonly
Returns the value of attribute options.
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 Attribute Details
#cached_response ⇒ responseCacheResponse?
Returns the value of attribute cached_response.
23 24 25 |
# File 'sig/plugins/response_cache.rbs', line 23 def cached_response @cached_response end |
#options ⇒ responseCacheOptions (readonly)
Returns the value of attribute options.
24 25 26 |
# File 'sig/plugins/response_cache.rbs', line 24 def @options end |
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 |