module HTTPX::Plugins::ResponseCache::OptionsMethods

  1. lib/httpx/plugins/response_cache.rb

adds support for the following options:

:supported_vary_headers

array of header values that will be considered for a “vary” header based cache validation (defaults to {SUPPORTED_VARY_HEADERS}).

: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+)

Public Instance methods

option_response_cache_store(value)
[show source]
   # File lib/httpx/plugins/response_cache.rb
70 def option_response_cache_store(value)
71   case value
72   when :store
73     Store.new
74   when :file_store
75     FileStore.new
76   else
77     value
78   end
79 end
option_supported_vary_headers(value)
[show source]
   # File lib/httpx/plugins/response_cache.rb
81 def option_supported_vary_headers(value)
82   Array(value).sort
83 end