public class DefaultLoadBalancerCache
extends org.springframework.cache.support.AbstractValueAdaptingCache
Cache
implementation used by Spring Cloud LoadBalancer. The current
implementation uses ConcurrentMapWithTimedEviction
underneath. Based on
ConcurrentMapCache
.ConcurrentMapWithTimedEviction
,
ConcurrentMapCache
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
evict(Object key) |
boolean |
evictIfPresent(Object key) |
<T> T |
get(Object key,
Callable<T> valueLoader) |
String |
getName() |
ConcurrentMap<Object,Object> |
getNativeCache() |
boolean |
invalidate() |
protected Object |
lookup(Object key) |
void |
put(Object key,
Object value) |
void |
put(Object key,
Object value,
long evictMs) |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(Object key,
Object value,
long evictMs) |
public DefaultLoadBalancerCache(String name)
name
- the name of the cachepublic DefaultLoadBalancerCache(String name, long evictMs, boolean allowNullValues)
name
- the name of the cacheevictMs
- default time to evict the entries
ConcurrentMapWithTimedEviction
allowNullValues
- whether to accept and convert null
values for this
cachepublic DefaultLoadBalancerCache(String name, boolean allowNullValues)
name
- the name of the cacheallowNullValues
- whether to accept and convert null
values for this
cacheprotected Object lookup(Object key)
lookup
in class org.springframework.cache.support.AbstractValueAdaptingCache
public String getName()
public ConcurrentMap<Object,Object> getNativeCache()
@Nullable public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, @Nullable Object value)
@Nullable public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, @Nullable Object value, long evictMs)
public void evict(Object key)
public boolean evictIfPresent(Object key)
public void clear()
public boolean invalidate()
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.