Package org.apache.hc.client5.http.cache
Interface HttpCacheStorage
- All Known Implementing Classes:
AbstractBinaryCacheStorage
,AbstractSerializingCacheStorage
,BasicHttpCacheStorage
,ManagedHttpCacheStorage
@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
Modifier and TypeMethodDescriptiongetEntries
(Collection<String> keys) Retrieves multiple cache entries stored under the given keys.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 Details
-
putEntry
Store a given cache entry under the given key.- Parameters:
key
- where in the cache to store the entryentry
- cached response to store- Throws:
ResourceIOException
-
getEntry
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
ornull
if no entry exists - Throws:
ResourceIOException
-
removeEntry
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 modifycasOperation
- the CAS operation to perform.- Throws:
ResourceIOException
HttpCacheUpdateException
-
getEntries
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
-