Package org.apache.hc.client5.http.cache
Interface HttpCacheStorage
-
- All Known Implementing Classes:
AbstractBinaryCacheStorage,AbstractSerializingCacheStorage,BasicHttpCacheStorage,ManagedHttpCacheStorage
@Contract(threading=SAFE) public interface HttpCacheStorageHttpCacheStorage 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 Description java.util.Map<java.lang.String,HttpCacheEntry>getEntries(java.util.Collection<java.lang.String> keys)Retrieves multiple cache entries stored under the given keys.HttpCacheEntrygetEntry(java.lang.String key)Retrieves the cache entry stored under the given key or null if no entry exists under that key.voidputEntry(java.lang.String key, HttpCacheEntry entry)Store a given cache entry under the given key.voidremoveEntry(java.lang.String key)Deletes/invalidates/removes any cache entries currently stored under the given key.voidupdateEntry(java.lang.String key, HttpCacheCASOperation casOperation)Atomically applies the given callback to processChallenge an existing cache entry under a given key.
-
-
-
Method Detail
-
putEntry
void putEntry(java.lang.String key, HttpCacheEntry entry) throws ResourceIOExceptionStore 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
HttpCacheEntry getEntry(java.lang.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
HttpCacheEntryornullif no entry exists - Throws:
ResourceIOException
-
removeEntry
void removeEntry(java.lang.String key) throws ResourceIOExceptionDeletes/invalidates/removes any cache entries currently stored under the given key.- Parameters:
key-- Throws:
ResourceIOException
-
updateEntry
void updateEntry(java.lang.String key, HttpCacheCASOperation casOperation) throws ResourceIOException, HttpCacheUpdateExceptionAtomically 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:
ResourceIOExceptionHttpCacheUpdateException
-
getEntries
java.util.Map<java.lang.String,HttpCacheEntry> getEntries(java.util.Collection<java.lang.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
HttpCacheEntrys. - Throws:
ResourceIOException- Since:
- 5.0
-
-