Module: HTTPX::Plugins::Cache::OptionsMethods
- Defined in:
- lib/httpx/plugins/cache.rb
Overview
adds support for the following options:
- :cache_key
-
callable which receives a request and returns the corresponding cache key as a string (to be used by the cache store when storing cached responses)
- :cacheable_request
-
callable which receives a request and returns whether this request can use a previously cached response, or for which a freshly retrieved response can be cached.
- :cacheable_response
-
callable which receives a request and a (freshly retrieved) response and returns whether the response can be cached.
- :valid_cached_response
-
callable which receives a request and a (previously cached) response and returns whether the response can still be used / returned to the caller.
- :response_cache_store
-
object where cached responses are fetch from or stored in; defaults to
:store(in-memory cache), can be set to:file_store(file system cache store) as well, or any object which abides by the Cache Store Interface
The Cache Store Interface requires implementation of the following methods:
-
#get(request) -> response or nil
-
#set(request, response) -> void
-
#clear() -> void)