K - id 键值类型T - target 缓存对象的类型public class DerivativeCachedMap<K,D,T> extends AbstractCachedObject<Map<K,T>>
targetDEFAULT_REFRESH_PERIOD, KEEP_FRESH_PERIOD, NOT_REFRESH_PERIOD| Constructor and Description |
|---|
DerivativeCachedMap(Function<D,T> refresher,
CachedMap<K,D> parentCache) |
DerivativeCachedMap(Function<D,T> refresher,
CachedMap<K,D> parentCache,
int initialCapacity)
构造函数
|
| Modifier and Type | Method and Description |
|---|---|
void |
evictCache() |
void |
evictIdentifiedCache(K key) |
Map<K,T> |
getCachedTarget() |
T |
getCachedValue(K key) |
Map<K,T> |
getRawTarget() |
void |
setFreshPeriod(long freshPeriod) |
void |
setRefresher(Function<D,T> refresher) |
addDeriveCachepublic DerivativeCachedMap(Function<D,T> refresher, CachedMap<K,D> parentCache, int initialCapacity)
refresher - 重新获取代码的接口parentCache - 保鲜时间,单位为秒;也是重新刷新时间
它的意思不是每隔一段时间就刷新,而是在获取数据是检查是否超时,如果超时则刷新initialCapacity - The implementation performs internal
sizing to accommodate this many elements.public void setFreshPeriod(long freshPeriod)
public void evictIdentifiedCache(K key)
public void evictCache()
evictCache in interface ICachedObject<Map<K,T>>evictCache in class AbstractCachedObject<Map<K,T>>public Map<K,T> getCachedTarget()
getCachedTarget in class AbstractCachedObject<Map<K,T>>Copyright © 2024 江苏南大先腾信息产业股份有限公司. All rights reserved.