Methods
Public Class
Public Instance
Attributes
cached_response | [RW] |
points to a previously cached |
Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/response_cache.rb 187 def initialize(*) 188 super 189 @cached_response = nil 190 end
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 198 def cacheable_verb? 199 CACHEABLE_VERBS.include?(@verb) 200 end
merge_headers(*)
[show source]
# File lib/httpx/plugins/response_cache.rb 192 def merge_headers(*) 193 super 194 @response_cache_key = nil 195 end
response_cache_key()
returns a unique cache key as a String identifying this request
[show source]
# File lib/httpx/plugins/response_cache.rb 203 def response_cache_key 204 @response_cache_key ||= begin 205 keys = [@verb, @uri] 206 207 @options.supported_vary_headers.each do |field| 208 value = @headers[field] 209 210 keys << value if value 211 end 212 Digest::SHA1.hexdigest("httpx-response-cache-#{keys.join("-")}") 213 end 214 end