Module: HTTPX::Plugins::Cache::RequestMethods

Defined in:
lib/httpx/plugins/cache.rb,
sig/plugins/cache.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cached_responsecacheResponse?

points to a previously cached Response corresponding to this request.

Returns:

  • (cacheResponse, nil)


167
168
169
# File 'lib/httpx/plugins/cache.rb', line 167

def cached_response
  @cached_response
end

#optionscacheOptions (readonly)

Returns the value of attribute options.

Returns:

  • (cacheOptions)


42
43
44
# File 'sig/plugins/cache.rbs', line 42

def options
  @options
end

Instance Method Details

#initializeObject



169
170
171
172
# File 'lib/httpx/plugins/cache.rb', line 169

def initialize(*)
  super
  @cached_response = nil
end

#merge_headersObject



174
175
176
177
# File 'lib/httpx/plugins/cache.rb', line 174

def merge_headers(*)
  super
  @response_cache_key = nil
end

#response_cache_keyString?

returns a unique cache key as a String identifying this request

Returns:

  • (String, nil)


180
181
182
183
184
# File 'lib/httpx/plugins/cache.rb', line 180

def response_cache_key
  return unless (call = @options.cache_key)

  call[self]
end