public interface Cache
| Modifier and Type | Interface and Description |
|---|---|
static class |
Cache.Builder |
static interface |
Cache.Key
Interface for the cache key which can be implemented by consumers
The key should implement equals and hashCode
It must must return the time the key was created.
|
static interface |
Cache.KeyGenerator
A functional interface to generate a cache key
|
| Modifier and Type | Method and Description |
|---|---|
static Cache.Builder |
builder()
a builder for cache options
|
<T> HttpResponse |
get(Cache.Key key,
Supplier<HttpResponse<T>> fetcher)
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
|
<T> CompletableFuture |
getAsync(Cache.Key key,
Supplier<CompletableFuture<HttpResponse<T>>> fetcher)
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
|
<T> HttpResponse get(Cache.Key key, Supplier<HttpResponse<T>> fetcher)
T - the type of responsekey - the cache keyfetcher - a function to execute the request and return the response. This response should be
cached by the implementation<T> CompletableFuture getAsync(Cache.Key key, Supplier<CompletableFuture<HttpResponse<T>>> fetcher)
T - the type of responsekey - the cache keyfetcher - a function to execute the request and return the response. This response should be
cached by the implementationstatic Cache.Builder builder()
Copyright © 2020. All rights reserved.