Module methanol

Interface HttpCache.Listener

Enclosing class:

public static interface HttpCache.Listener
A listener to request/response & read/write events within the cache.
  • Method Details

    • onRequest

      default void onRequest(HttpRequest request)
      Called when the cache receives a request.
    • onNetworkUse

      default void onNetworkUse(HttpRequest request, @Nullable TrackedResponse<?> cacheResponse)
      Called when the cache is about to use network due to a cache miss. The given response represents the inapplicable stored response if one was available.
    • onResponse

      default void onResponse(HttpRequest request, CacheAwareResponse<?> response)
      Called when the cache is ready to serve the response. The given response's cache status can be examined to know how the response was constructed by the cache. This method is called before the response body is read.
    • onReadSuccess

      default void onReadSuccess(HttpRequest request)
      Called when the response body is successfully read from cache.
    • onReadFailure

      default void onReadFailure(HttpRequest request, Throwable error)
      Called when a read failure is encountered while reading the response body from cache.
    • onWriteSuccess

      default void onWriteSuccess(HttpRequest request)
      Called when the response body is successfully written to cache.
    • onWriteFailure

      default void onWriteFailure(HttpRequest request, Throwable error)
      Called when a write failure is encountered while writing the response body to cache.