Class DefaultLoadBalancerCache
java.lang.Object
org.springframework.cache.support.AbstractValueAdaptingCache
org.springframework.cloud.loadbalancer.cache.DefaultLoadBalancerCache
- All Implemented Interfaces:
org.springframework.cache.Cache
public class DefaultLoadBalancerCache
extends org.springframework.cache.support.AbstractValueAdaptingCache
A default
Cache implementation used by Spring Cloud LoadBalancer. The current
implementation uses ConcurrentMapWithTimedEviction underneath. Based on
ConcurrentMapCache.- Since:
- 2.2.0
- Author:
- Olga Maciaszek-Sharma
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.cache.Cache
org.springframework.cache.Cache.ValueRetrievalException, org.springframework.cache.Cache.ValueWrapper -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new DefaultCache with the specified name.DefaultLoadBalancerCache(String name, boolean allowNullValues) Create a new EvictorCache with the specified name.DefaultLoadBalancerCache(String name, long evictMs, boolean allowNullValues) Create a new DefaultCache with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidbooleanevictIfPresent(Object key) <T> @Nullable TgetName()booleanprotected Objectvoidvoid@Nullable org.springframework.cache.Cache.ValueWrapperputIfAbsent(Object key, @Nullable Object value) @Nullable org.springframework.cache.Cache.ValueWrapperputIfAbsent(Object key, @Nullable Object value, long evictMs) Methods inherited from class org.springframework.cache.support.AbstractValueAdaptingCache
fromStoreValue, get, get, isAllowNullValues, toStoreValue, toValueWrapperMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.cache.Cache
retrieve, retrieve
-
Constructor Details
-
DefaultLoadBalancerCache
Create a new DefaultCache with the specified name.- Parameters:
name- the name of the cache
-
DefaultLoadBalancerCache
Create a new DefaultCache with the specified name.- Parameters:
name- the name of the cacheevictMs- default time to evict the entriesConcurrentMapWithTimedEvictionallowNullValues- whether to accept and convertnullvalues for this cache
-
DefaultLoadBalancerCache
Create a new EvictorCache with the specified name.- Parameters:
name- the name of the cacheallowNullValues- whether to accept and convertnullvalues for this cache
-
-
Method Details
-
lookup
-
getName
-
getNativeCache
-
get
-
put
-
putIfAbsent
-
putIfAbsent
-
put
-
evict
-
evictIfPresent
-
clear
public void clear() -
invalidate
public boolean invalidate()
-