Package kong.unirest.core
Class CacheManager.CacheMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<Cache.Key,java.lang.Object>
-
- kong.unirest.core.CacheManager.CacheMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<Cache.Key,java.lang.Object>,Cache
- Enclosing class:
- CacheManager
private static class CacheManager.CacheMap extends java.util.LinkedHashMap<Cache.Key,java.lang.Object> implements Cache
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface kong.unirest.core.Cache
Cache.Builder, Cache.Key, Cache.KeyGenerator
-
-
Constructor Summary
Constructors Constructor Description CacheMap(int maxSize, long ttl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidclearOld()<T> HttpResponse<T>get(Cache.Key key, java.util.function.Supplier<HttpResponse<T>> fetcher)Returns the cached HttpResponse for a key or uses the Supplier to fetch the response<T> java.util.concurrent.CompletableFuturegetAsync(Cache.Key key, java.util.function.Supplier<java.util.concurrent.CompletableFuture<HttpResponse<T>>> fetcher)Returns the cached HttpResponse for a key or uses the Supplier to fetch the responseprotected booleanremoveEldestEntry(java.util.Map.Entry<Cache.Key,java.lang.Object> eldest)-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
get
public <T> HttpResponse<T> get(Cache.Key key, java.util.function.Supplier<HttpResponse<T>> fetcher)
Description copied from interface:CacheReturns the cached HttpResponse for a key or uses the Supplier to fetch the response
-
getAsync
public <T> java.util.concurrent.CompletableFuture getAsync(Cache.Key key, java.util.function.Supplier<java.util.concurrent.CompletableFuture<HttpResponse<T>>> fetcher)
Description copied from interface:CacheReturns the cached HttpResponse for a key or uses the Supplier to fetch the response
-
clearOld
private void clearOld()
-
-