- Added support for
Cache-Control: stale-while-revalidate. - Added
:on_stalemiddleware callback hook to trigger custom background refresh logic when stale cached responses are served.
2.7.0 (2026-04-14)
- Support headers passed in using string keys when Vary header is in a different case via #137 (thanks @evman182)
- Add
reason_phrasefrom the HTTP response to the data stored in the cache according to RFC7230 via #134
- Require
LoggerinBaseStrategyvia #131 - Use unique and sorted headers from the Vary header in
ByVarystrategy via #132
- Introduced a new
strategyoption to support different cache storage strategies. - The original strategy moved from
Faraday::HttpCache::StoragetoFaraday::HttpCache::Strategies::ByUrl. - The new
Faraday::HttpCache::Strategies::ByVarystrategy uses headers fromVaryheader to generate cache keys. It also uses the index withVaryheaders mapped to the request URL. Faraday::HttpCache::Storageclass deprecated.
- Added support for Ruby 3.0, 3.1.
- Ruby version constraint changed to 2.4.0.
- Support for faraday 1.x
- Ruby version constraint changed to 2.1.0.
- Changed
Faraday::HttpCache#initializeto use keyword arguments instead of aHash.
- Reject invalid
Dateresponse headers instead of letting the exception bubble.
no-cacheresponses won't be treated as fresh and will always be revalidated.
- Update the
CACHE_STATUSESto properly instrument requests with theCache-Control: no-storeheader.
- Update the
CACHE_STATUSESto better instrumentinvalidanduncacheableresponses.
- Deprecate the default instrumenter name
process_request.http_cache.faradayin favor ofhttp_cache.faraday.
- Added support for
:instrumenter_nameoption. - 307 responses (
Temporary Redirects) are now cached. - Do not crash on non RFC 2616 compliant
Expiresheaders.
- Instrumentation supported. (by @dasch)
- Illegal headers from
304responses will be removed before updating the cached responses. (by @dasch)
- Fixed HTTP method matching that failed when using the
Marshalserializer. (by @toddmazierski)
- Deprecated configuration API removed.
- Better support for the caching mechanisms described in the RFC 7234, including:
- Reworked the data structures that are stored in the underlying store to store responses under the same URL and HTTP method.
- Cached responses are invalidated after a
PUT/POST/DELETErequest. - Support for the
Varyheader as a second logic to retrieve a stored response.
- Header values are explicitly part of the cache key for all requests.
- Encoding conversion exceptions will emit a log warning before raising through
the middleware stack. Use
Marshalinstead ofJSONto serialize such requests. - Compatible with latest ActiveSupport and Faraday versions.