K - id 键值类型T - target 缓存对象的类型public class CachedMap<K,T> extends AbstractCachedObject<Map<K,T>>
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
logger |
targetDEFAULT_REFRESH_PERIOD, KEEP_FRESH_PERIOD, NOT_REFRESH_PERIOD| 构造器和说明 |
|---|
CachedMap() |
CachedMap(Function<K,T> refresher,
AbstractCachedObject<?> parentCache) |
CachedMap(Function<K,T> refresher,
AbstractCachedObject<?> parentCache,
int initialCapacity) |
CachedMap(Function<K,T> refresher,
long freshPeriod)
构造函数
|
CachedMap(Function<K,T> refresher,
long freshPeriod,
int initialCapacity)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
evictCache() |
void |
evictIdentifiedCache(K key) |
AbstractCachedObject<T> |
getCachedObject(K key) |
Map<K,T> |
getCachedTarget() |
T |
getCachedValue(K key) |
T |
getFreshValue(K key) |
Map<K,T> |
getRawTarget() |
boolean |
isFreshData(K key) |
void |
setFreshData(K key,
T freshData) |
void |
setFreshPeriod(long freshPeriod) |
void |
setRefresher(Function<K,T> refresher) |
addDeriveCachepublic CachedMap(Function<K,T> refresher, long freshPeriod, int initialCapacity)
refresher - 重新获取代码的接口freshPeriod - 保鲜时间,单位为秒;也是重新刷新时间
它的意思不是每隔一段时间就刷新,而是在获取数据是检查是否超时,如果超时则刷新initialCapacity - The implementation performs internal
sizing to accommodate this many elements.public CachedMap()
public CachedMap(Function<K,T> refresher, AbstractCachedObject<?> parentCache, int initialCapacity)
public CachedMap(Function<K,T> refresher, long freshPeriod)
freshPeriod - 保鲜时间,单位为秒;也是重新刷新时间
它的意思不是每隔一段时间就刷新,而是在获取数据是检查是否超时,如果超时则刷新refresher - 重新获取代码的接口public CachedMap(Function<K,T> refresher, AbstractCachedObject<?> parentCache)
public void setFreshPeriod(long freshPeriod)
public void evictIdentifiedCache(K key)
public void evictCache()
evictCache 在接口中 ICachedObject<Map<K,T>>evictCache 在类中 AbstractCachedObject<Map<K,T>>public AbstractCachedObject<T> getCachedObject(K key)
public Map<K,T> getCachedTarget()
getCachedTarget 在类中 AbstractCachedObject<Map<K,T>>public boolean isFreshData(K key)
Copyright © 2025 江苏南大先腾信息产业股份有限公司. All rights reserved.