evictExpiredInterval, nextEvictExpiredTime, nextRefreshAllTime, refreshAllInterval, refreshAllTimeoutHolder, running, timer| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractCache(int maxCapacity,
long evictExpiredInterval) |
protected |
AbstractCache(int maxCapacity,
long evictExpiredInterval,
long refreshAllInterval,
Timer timer) |
protected |
AbstractCache(int maxCapacity,
long evictExpiredInterval,
Timer timer) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract void |
addToCache(Entry<K,V> entry) |
protected abstract void |
afterRead(Entry<K,V> entry) |
protected abstract void |
afterRecomputeExpireTimeOnRead(Entry<K,V> entry) |
protected abstract void |
beforeRead(Entry<K,V> entry) |
protected abstract void |
beforeRecomputeExpireTimeOnRead(Entry<K,V> entry) |
void |
clean() |
void |
evictExpired() |
protected abstract List<K> |
forceEvict(int count)
用于找到将被强制清除的
|
V |
get(K key)
get by key
|
V |
get(K key,
Supplier<K,V> loader) |
Map<K,V> |
getAll(Iterable<K> keys)
multiple get
|
Map<K,V> |
getAllIfPresent(Iterable<K> keys)
multiple get
|
V |
getIfPresent(K key) |
protected void |
incrementUsedCount(Entry<K,V> entry) |
Set<K> |
keys() |
void |
refresh(K key) |
protected void |
refreshAllAsync(Timeout timeout) |
List<V> |
remove(Collection<K> keys) |
V |
remove(K key) |
protected V |
remove(K key,
RemoveCause cause) |
protected abstract void |
removeFromCache(Entry<K,V> entry,
RemoveCause removeCause) |
void |
set(K key,
V value)
set a key-value to cache, with out expire time never
|
void |
set(K key,
V value,
long expire)
set a key-value to cache, with the specified expire time
|
void |
set(K key,
V value,
long duration,
TimeUnit timeUnit)
set a key-value to cache, with the specified expire time
|
protected void |
setCapacityHeightWater(float capacityHeightWater) |
protected void |
setEvictExpiredInterval(long evictExpiredInterval) |
protected void |
setExpireAfterRead(long expireAfterRead) |
protected void |
setExpireAfterWrite(long expireAfterWrite) |
protected void |
setGlobalLoader(Loader<K,V> globalLoader) |
void |
setKeyReferenceType(ReferenceType keyReferenceType) |
protected void |
setMap(ConcurrentReferenceHashMap<K,Entry<K,V>> map) |
protected void |
setMaxCapacity(int maxCapacity) |
void |
setReferenceQueue(ReferenceQueue referenceQueue) |
protected void |
setRefreshAfterAccess(long refreshAfterAccess) |
protected void |
setRefreshAllInterval(long refreshAllInterval) |
protected void |
setRemoveListener(RemoveListener<K,V> removeListener) |
void |
setTimer(Timer timer) |
void |
setValueReferenceType(ReferenceType valueReferenceType) |
int |
size() |
Map<K,V> |
toMap() |
cancelRefreshAll, refreshAllAsync, setDistinctWhenRefresh, shutdown, startupprotected AbstractCache(int maxCapacity,
long evictExpiredInterval)
protected AbstractCache(int maxCapacity,
long evictExpiredInterval,
Timer timer)
protected AbstractCache(int maxCapacity,
long evictExpiredInterval,
long refreshAllInterval,
Timer timer)
public void setKeyReferenceType(ReferenceType keyReferenceType)
public void setValueReferenceType(ReferenceType valueReferenceType)
public void setReferenceQueue(ReferenceQueue referenceQueue)
public void set(@NonNull K key, @Nullable V value)
Cachekey - the keyvalue - the valuepublic void set(@NonNull K key, @Nullable V value, long duration, TimeUnit timeUnit)
Cachekey - the keyvalue - the valueduration - the time-to-live time, the live timepublic void set(@NonNull K key, @Nullable V value, long expire)
Cachekey - the keyvalue - the valueexpire - the expire timepublic V get(@NonNull K key)
Cachekey - the keypublic Map<K,V> getAll(Iterable<K> keys)
Cachekeys - get the specified keyspublic Map<K,V> getAllIfPresent(Iterable<K> keys)
Cachekeys - get the specified keysprotected abstract void beforeRecomputeExpireTimeOnRead(Entry<K,V> entry)
protected abstract void afterRecomputeExpireTimeOnRead(Entry<K,V> entry)
protected void refreshAllAsync(@Nullable Timeout timeout)
refreshAllAsync 在类中 BaseCache<K,V>timeout - protected abstract void removeFromCache(Entry<K,V> entry, RemoveCause removeCause)
protected final V remove(@NonNull K key, @NonNull RemoveCause cause)
public List<V> remove(Collection<K> keys)
public void evictExpired()
protected abstract List<K> forceEvict(int count)
count - the count will be evictedpublic void clean()
public int size()
protected void setMap(ConcurrentReferenceHashMap<K,Entry<K,V>> map)
protected void setExpireAfterWrite(long expireAfterWrite)
protected void setExpireAfterRead(long expireAfterRead)
protected void setEvictExpiredInterval(long evictExpiredInterval)
protected void setRemoveListener(RemoveListener<K,V> removeListener)
protected void setMaxCapacity(int maxCapacity)
protected void setCapacityHeightWater(float capacityHeightWater)
protected void setRefreshAfterAccess(long refreshAfterAccess)
protected void setRefreshAllInterval(long refreshAllInterval)
public void setTimer(Timer timer)
Copyright © 2022. All rights reserved.