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.AbstractValueAdaptingCacheA defaultCacheimplementation used by Spring Cloud LoadBalancer. The current implementation usesConcurrentMapWithTimedEvictionunderneath. Based onConcurrentMapCache.- Since:
- 2.2.0
- Author:
- Olga Maciaszek-Sharma
- See Also:
- Evictor,
ConcurrentMapWithTimedEviction,ConcurrentMapCache
-
-
Constructor Summary
Constructors Constructor Description DefaultLoadBalancerCache(String name)Create 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidevict(Object key)booleanevictIfPresent(Object key)<T> Tget(Object key, Callable<T> valueLoader)StringgetName()ConcurrentMap<Object,Object>getNativeCache()booleaninvalidate()protected Objectlookup(Object key)voidput(Object key, Object value)voidput(Object key, Object value, long evictMs)org.springframework.cache.Cache.ValueWrapperputIfAbsent(Object key, Object value)org.springframework.cache.Cache.ValueWrapperputIfAbsent(Object key, Object value, long evictMs)
-
-
-
Constructor Detail
-
DefaultLoadBalancerCache
public DefaultLoadBalancerCache(String name)
Create a new DefaultCache with the specified name.- Parameters:
name- the name of the cache
-
DefaultLoadBalancerCache
public DefaultLoadBalancerCache(String name, long evictMs, boolean allowNullValues)
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
public DefaultLoadBalancerCache(String name, boolean allowNullValues)
Create a new EvictorCache with the specified name.- Parameters:
name- the name of the cacheallowNullValues- whether to accept and convertnullvalues for this cache
-
-
Method Detail
-
lookup
protected Object lookup(Object key)
- Specified by:
lookupin classorg.springframework.cache.support.AbstractValueAdaptingCache
-
getName
public String getName()
-
getNativeCache
public ConcurrentMap<Object,Object> getNativeCache()
-
putIfAbsent
@Nullable public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, @Nullable Object value)
-
putIfAbsent
@Nullable public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, @Nullable Object value, long evictMs)
-
evict
public void evict(Object key)
-
evictIfPresent
public boolean evictIfPresent(Object key)
-
clear
public void clear()
-
invalidate
public boolean invalidate()
-
-