org.apache.hc.client5.http.cache

## Interface HttpCacheStorage

- All Known Implementing Classes:
    AbstractBinaryCacheStorage, AbstractSerializingCacheStorage, BasicHttpCacheStorage, EhcacheHttpCacheStorage, ManagedHttpCacheStorage, MemcachedHttpCacheStorage

      @Contract(threading=SAFE)
      public interface HttpCacheStorage

  HttpCacheStorage represents an abstract HTTP cache storage backend that can then be plugged into the classic (blocking) request execution pipeline.

  Implementations of this interface are expected to be threading-safe.

  Since:
    4.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,HttpCacheEntry>` | `getEntries(Collection<String> keys)` Retrieves multiple cache entries stored under the given keys.
    `HttpCacheEntry` | `getEntry(String key)` Retrieves the cache entry stored under the given key or null if no entry exists under that key.
    `void` | `putEntry(String key, HttpCacheEntry entry)` Store a given cache entry under the given key.
    `void` | `removeEntry(String key)` Deletes/invalidates/removes any cache entries currently stored under the given key.
    `void` | `updateEntry(String key, HttpCacheCASOperation casOperation)` Atomically applies the given callback to processChallenge an existing cache entry under a given key.

- - ### Method Detail

    - #### putEntry

          void putEntry(String key,
                        HttpCacheEntry entry)
                 throws ResourceIOException

      Store a given cache entry under the given key.
      Parameters:
        `key` - where in the cache to store the entry
        `entry` - cached response to store
      Throws:
        `ResourceIOException`

    - #### getEntry

          HttpCacheEntry getEntry(String key)
                           throws ResourceIOException

      Retrieves the cache entry stored under the given key or null if no entry exists under that key.
      Parameters:
        `key` - cache key
      Returns:
        an `HttpCacheEntry` or `null` if no entry exists
      Throws:
        `ResourceIOException`

    - #### removeEntry

          void removeEntry(String key)
                    throws ResourceIOException

      Deletes/invalidates/removes any cache entries currently stored under the given key.
      Parameters:
        `key` -
      Throws:
        `ResourceIOException`

    - #### updateEntry

          void updateEntry(String key,
                           HttpCacheCASOperation casOperation)
                    throws ResourceIOException,
                           HttpCacheUpdateException

      Atomically applies the given callback to processChallenge an existing cache entry under a given key.
      Parameters:
        `key` - indicates which entry to modify
        `casOperation` - the CAS operation to perform.
      Throws:
        `ResourceIOException`
        `HttpCacheUpdateException`

    - #### getEntries

          Map<String,HttpCacheEntry> getEntries(Collection<String> keys)
                                         throws ResourceIOException

      Retrieves multiple cache entries stored under the given keys. Some implementations may use a single bulk operation to do the retrieval.
      Parameters:
        `keys` - cache keys
      Returns:
        an map of `HttpCacheEntry`s.
      Throws:
        `ResourceIOException`
      Since:
        5.0

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.