Interface Cache
- All Known Implementing Classes:
CacheManager.CacheMap
public interface Cache
Cache interface for response caching
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic interfaceInterface 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 interfaceA functional interface to generate a cache key -
Method Summary
Modifier and TypeMethodDescriptionstatic Cache.Builderbuilder()a builder for cache options<T> HttpResponseget(Cache.Key key, Supplier<HttpResponse<T>> fetcher) Returns the cached HttpResponse for a key or uses the Supplier to fetch the responsegetAsync(Cache.Key key, Supplier<CompletableFuture<HttpResponse<T>>> fetcher) Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
-
Method Details
-
get
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response- Type Parameters:
T- the type of response- Parameters:
key- the cache keyfetcher- a function to execute the request and return the response. This response should be cached by the implementation- Returns:
- the Http Response
-
getAsync
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response- Type Parameters:
T- the type of response- Parameters:
key- the cache keyfetcher- a function to execute the request and return the response. This response should be cached by the implementation- Returns:
- the CompletableFuture for the response
-
builder
-