Public Instance methods
build_request(*)
[show source]
# File lib/httpx/plugins/response_cache.rb 69 def build_request(*) 70 request = super 71 return request unless ResponseCache.cacheable_request?(request) && @options.response_cache_store.cached?(request) 72 73 @options.response_cache_store.prepare(request) 74 75 request 76 end
clear_response_cache()
[show source]
# File lib/httpx/plugins/response_cache.rb 65 def clear_response_cache 66 @options.response_cache_store.clear 67 end
fetch_response(request, *)
[show source]
# File lib/httpx/plugins/response_cache.rb 78 def fetch_response(request, *) 79 response = super 80 81 return unless response 82 83 if ResponseCache.cached_response?(response) 84 log { "returning cached response for #{request.uri}" } 85 cached_response = @options.response_cache_store.lookup(request) 86 87 response.copy_from_cached(cached_response) 88 89 else 90 @options.response_cache_store.cache(request, response) 91 end 92 93 response 94 end