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
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.HttpCacheEntry
getEntry(java.lang.String key)
Retrieves the cache entry stored under the given key or null if no entry exists under that key.void
putEntry(java.lang.String key, HttpCacheEntry entry)
Store a given cache entry under the given key.void
removeEntry(java.lang.String key)
Deletes/invalidates/removes any cache entries currently stored under the given key.void
updateEntry(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 ResourceIOException
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
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
HttpCacheEntry
ornull
if no entry exists - Throws:
ResourceIOException
-
removeEntry
void removeEntry(java.lang.String key) throws ResourceIOException
Deletes/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, 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
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
HttpCacheEntry
s. - Throws:
ResourceIOException
- Since:
- 5.0
-
-