Package org.apache.hc.client5.http.cache
Interface HttpAsyncCacheStorage
- All Known Implementing Classes:
AbstractBinaryAsyncCacheStorage
,AbstractSerializingAsyncCacheStorage
,HttpAsyncCacheStorageAdaptor
@Contract(threading=SAFE)
public interface HttpAsyncCacheStorage
HttpAsyncCacheStorage represents an abstract HTTP cache
storage backend that can then be plugged into the asynchronous
(non-blocking ) request execution
pipeline.
Implementations of this interface are expected to be threading-safe.
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hc.core5.concurrent.Cancellable
getEntries
(Collection<String> keys, org.apache.hc.core5.concurrent.FutureCallback<Map<String, HttpCacheEntry>> callback) Retrieves multiple cache entries stored under the given keys.org.apache.hc.core5.concurrent.Cancellable
getEntry
(String key, org.apache.hc.core5.concurrent.FutureCallback<HttpCacheEntry> callback) Retrieves the cache entry stored under the given key or null if no entry exists under that key.org.apache.hc.core5.concurrent.Cancellable
putEntry
(String key, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) Store a given cache entry under the given key.org.apache.hc.core5.concurrent.Cancellable
removeEntry
(String key, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) Deletes/invalidates/removes any cache entries currently stored under the given key.org.apache.hc.core5.concurrent.Cancellable
updateEntry
(String key, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) Atomically applies the given callback to processChallenge an existing cache entry under a given key.
-
Method Details
-
putEntry
org.apache.hc.core5.concurrent.Cancellable putEntry(String key, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) Store a given cache entry under the given key.- Parameters:
key
- where in the cache to store the entryentry
- cached response to storecallback
- result callback
-
getEntry
org.apache.hc.core5.concurrent.Cancellable getEntry(String key, org.apache.hc.core5.concurrent.FutureCallback<HttpCacheEntry> callback) Retrieves the cache entry stored under the given key or null if no entry exists under that key.- Parameters:
key
- cache keycallback
- result callback- Returns:
- an
HttpCacheEntry
ornull
if no entry exists
-
removeEntry
org.apache.hc.core5.concurrent.Cancellable removeEntry(String key, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) Deletes/invalidates/removes any cache entries currently stored under the given key.- Parameters:
key
-callback
- result callback
-
updateEntry
org.apache.hc.core5.concurrent.Cancellable updateEntry(String key, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<Boolean> callback) 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.callback
- result callback
-
getEntries
org.apache.hc.core5.concurrent.Cancellable getEntries(Collection<String> keys, org.apache.hc.core5.concurrent.FutureCallback<Map<String, HttpCacheEntry>> callback) Retrieves multiple cache entries stored under the given keys. Some implementations may use a single bulk operation to do the retrieval.- Parameters:
keys
- cache keyscallback
- result callback
-