Class FaradayMiddleware::Caching
In: lib/faraday_middleware/response/caching.rb
Parent: Faraday::Middleware

Public: Caches GET responses and pulls subsequent ones from the cache.

Methods

Constants

CACHEABLE_STATUS_CODES = [200, 203, 300, 301, 302, 404, 410]   Internal: List of status codes that can be cached:
  • 200 - ‘OK‘
  • 203 - ‘Non-Authoritative Information‘
  • 300 - ‘Multiple Choices‘
  • 301 - ‘Moved Permanently‘
  • 302 - ‘Found‘
  • 404 - ‘Not Found‘
  • 410 - ‘Gone‘

Attributes

cache  [R] 

Public Class methods

Public: initialize the middleware.

cache - An object that responds to read and write (default: nil). options - An options Hash (default: {}):

          :ignore_params - String name or Array names of query params
                           that should be ignored when forming the cache
                           key (default: []).
          :write_options - Hash of settings that should be passed as the third
                           options parameter to the cache's #write method. If not
                           specified, no options parameter will be passed.

Yields if no cache is given. The block should return a cache object.

Public Instance methods

[Validate]