Central HTTP cache.
Calls the relevant methods on the async handler, providing it with the cached response.
An async handler that accumulates response data to place in cache with the given key.
An async handler that accumulates a response and stores it to cache in the background.
A very simple cache trait.
A very simple cache trait.
Implementations can write adapters that map through to this trait, i.e.
class CaffeineHttpCache extends Cache { val underlying = Caffeine.newBuilder() .ticker(Ticker.systemTicker()) .expireAfterWrite(365, TimeUnit.DAYS) .build[EffectiveURIKey, ResponseEntry]() override def remove(key: EffectiveURIKey) = Future.successful(Option(underlying.invalidate(key)) override def put(key: EffectiveURIKey, entry: ResponseEntry) = Future.successful(underlying.put(key, entry)) override def get(key: EffectiveURIKey) = Future.successful(underlying.getIfPresent(key)) override def close(): Unit = underlying.cleanUp() }
A wrapper to return a ListenableFuture.
A provider that pulls a response from the cache.
A cache entry with an optional expiry time
Central HTTP cache. This keeps a cache of HTTP responses according to https://tools.ietf.org/html/rfc7234#section-2
The primary cache key consists of the request method and target URI. However, since HTTP caches in common use today are typically limited to caching responses to GET, many caches simply decline other methods and use only the URI as the primary cache key.