Interface CacheStore

All Known Implementing Classes:
DiskCacheStore, MemoryCacheStore

public interface CacheStore
Where HttpCache keeps responses. Implementations must be safe for concurrent use; MemoryCacheStore and DiskCacheStore are provided.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of stored responses (variants).
    get(String key)
    The stored variants for key (a URL), most recently stored first; empty if none.
    void
    put(CachedResponse response)
    Stores response, replacing the variant of its key with the same vary values.
    void
    Removes every variant stored for key.
    long
    Returns the total CachedResponse.weight() of what is stored.
  • Method Details

    • get

      The stored variants for key (a URL), most recently stored first; empty if none.
      Parameters:
      key - the URL whose variants to retrieve
      Returns:
      the stored variants for key (a URL), most recently stored first; empty if none
    • put

      void put(CachedResponse response)
      Stores response, replacing the variant of its key with the same vary values.
      Parameters:
      response - the response being handled
    • remove

      void remove(String key)
      Removes every variant stored for key.
      Parameters:
      key - the URL whose variants to remove
    • size

      long size()
      Returns the total CachedResponse.weight() of what is stored.
      Returns:
      the total CachedResponse.weight() of what is stored
    • count

      int count()
      Returns the number of stored responses (variants).
      Returns:
      the number of stored responses (variants)