Module: HTTPX::Plugins::ResponseCache
- Defined in:
- lib/httpx/plugins/response_cache.rb,
lib/httpx/plugins/response_cache/store.rb
Overview
Defined Under Namespace
Modules: InstanceMethods, OptionsMethods, ResponseMethods
Classes: Store
Class Method Summary
collapse
Class Method Details
.cacheable_request?(request) ⇒ Boolean
19
20
21
|
# File 'lib/httpx/plugins/response_cache.rb', line 19
def cacheable_request?(request)
CACHEABLE_VERBS.include?(request.verb)
end
|
.cacheable_response?(response) ⇒ Boolean
23
24
25
26
27
28
29
|
# File 'lib/httpx/plugins/response_cache.rb', line 23
def cacheable_response?(response)
response.is_a?(Response) &&
response.status != 206 && (
response..key?("etag") || response..key?("last-modified-at")
)
end
|
.cached_response?(response) ⇒ Boolean
31
32
33
|
# File 'lib/httpx/plugins/response_cache.rb', line 31
def cached_response?(response)
response.is_a?(Response) && response.status == 304
end
|
35
36
37
|
# File 'lib/httpx/plugins/response_cache.rb', line 35
def (options)
options.merge(response_cache_store: Store.new)
end
|
.load_dependencies ⇒ Object
15
16
17
|
# File 'lib/httpx/plugins/response_cache.rb', line 15
def load_dependencies(*)
require_relative "response_cache/store"
end
|