Class CacheManager.CacheMap
- All Implemented Interfaces:
Serializable, Cloneable, Map<Cache.Key, Object>, SequencedMap<Cache.Key, Object>, Cache
- Enclosing class:
CacheManager
private static class CacheManager.CacheMap
extends LinkedHashMap<Cache.Key, Object>
implements Cache
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> Nested classes/interfaces inherited from interface Cache
Cache.Builder, Cache.Key, Cache.KeyGenerator -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidclearOld()<T> HttpResponse<T> get(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 responseprotected booleanremoveEldestEntry(Map.Entry<Cache.Key, Object> eldest) Methods inherited from class LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
maxSize
private final int maxSize -
ttl
private long ttl
-
-
Constructor Details
-
CacheMap
CacheMap(int maxSize, long ttl)
-
-
Method Details
-
get
Description copied from interface:CacheReturns the cached HttpResponse for a key or uses the Supplier to fetch the response -
getAsync
public <T> CompletableFuture getAsync(Cache.Key key, Supplier<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() -
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<Cache.Key, Object>
-