Package org.apache.hc.client5.http.cache
Class HttpAsyncCacheStorageAdaptor
- java.lang.Object
-
- org.apache.hc.client5.http.cache.HttpAsyncCacheStorageAdaptor
-
- All Implemented Interfaces:
HttpAsyncCacheStorage
@Contract(threading=SAFE_CONDITIONAL) public final class HttpAsyncCacheStorageAdaptor extends java.lang.Object implements HttpAsyncCacheStorage
HttpAsyncCacheStorage
implementation that emulates asynchronous behavior using an instance of classicHttpCacheStorage
.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description private HttpCacheStorage
cacheStorage
-
Constructor Summary
Constructors Constructor Description HttpAsyncCacheStorageAdaptor(HttpCacheStorage cacheStorage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.hc.core5.concurrent.Cancellable
getEntries(java.util.Collection<java.lang.String> keys, org.apache.hc.core5.concurrent.FutureCallback<java.util.Map<java.lang.String,HttpCacheEntry>> callback)
Retrieves multiple cache entries stored under the given keys.org.apache.hc.core5.concurrent.Cancellable
getEntry(java.lang.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(java.lang.String key, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Store a given cache entry under the given key.org.apache.hc.core5.concurrent.Cancellable
removeEntry(java.lang.String key, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Deletes/invalidates/removes any cache entries currently stored under the given key.org.apache.hc.core5.concurrent.Cancellable
updateEntry(java.lang.String key, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Atomically applies the given callback to processChallenge an existing cache entry under a given key.
-
-
-
Field Detail
-
cacheStorage
private final HttpCacheStorage cacheStorage
-
-
Constructor Detail
-
HttpAsyncCacheStorageAdaptor
public HttpAsyncCacheStorageAdaptor(HttpCacheStorage cacheStorage)
-
-
Method Detail
-
putEntry
public org.apache.hc.core5.concurrent.Cancellable putEntry(java.lang.String key, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Description copied from interface:HttpAsyncCacheStorage
Store a given cache entry under the given key.- Specified by:
putEntry
in interfaceHttpAsyncCacheStorage
- Parameters:
key
- where in the cache to store the entryentry
- cached response to storecallback
- result callback
-
getEntry
public org.apache.hc.core5.concurrent.Cancellable getEntry(java.lang.String key, org.apache.hc.core5.concurrent.FutureCallback<HttpCacheEntry> callback)
Description copied from interface:HttpAsyncCacheStorage
Retrieves the cache entry stored under the given key or null if no entry exists under that key.- Specified by:
getEntry
in interfaceHttpAsyncCacheStorage
- Parameters:
key
- cache keycallback
- result callback- Returns:
- an
HttpCacheEntry
ornull
if no entry exists
-
removeEntry
public org.apache.hc.core5.concurrent.Cancellable removeEntry(java.lang.String key, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Description copied from interface:HttpAsyncCacheStorage
Deletes/invalidates/removes any cache entries currently stored under the given key.- Specified by:
removeEntry
in interfaceHttpAsyncCacheStorage
callback
- result callback
-
updateEntry
public org.apache.hc.core5.concurrent.Cancellable updateEntry(java.lang.String key, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
Description copied from interface:HttpAsyncCacheStorage
Atomically applies the given callback to processChallenge an existing cache entry under a given key.- Specified by:
updateEntry
in interfaceHttpAsyncCacheStorage
- Parameters:
key
- indicates which entry to modifycasOperation
- the CAS operation to perform.callback
- result callback
-
getEntries
public org.apache.hc.core5.concurrent.Cancellable getEntries(java.util.Collection<java.lang.String> keys, org.apache.hc.core5.concurrent.FutureCallback<java.util.Map<java.lang.String,HttpCacheEntry>> callback)
Description copied from interface:HttpAsyncCacheStorage
Retrieves multiple cache entries stored under the given keys. Some implementations may use a single bulk operation to do the retrieval.- Specified by:
getEntries
in interfaceHttpAsyncCacheStorage
- Parameters:
keys
- cache keyscallback
- result callback
-
-