K - 键类型V - 值类型public class TimedCache<K extends Serializable,V extends Serializable> extends ReentrantCache<K,V> implements Closeable
lockcacheMap, capacity, existCustomTimeout, hitCount, keyLockMap, listener, missCount, timeout| Constructor and Description |
|---|
TimedCache(long ttl)
构造
|
TimedCache(long ttl,
long cleanupMs)
构造
|
TimedCache(long ttl,
long cleanupMs,
Map<K,CacheObj<K,V>> map)
构造
|
TimedCache(long ttl,
Map<K,CacheObj<K,V>> map)
构造
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelPruneSchedule()
取消定时清理
|
void |
close() |
protected int |
pruneCache()
清理过期对象
|
protected void |
schedulePrune(long delay)
定时清理
|
clear, containsKey, get, prune, put, remove, toStringcacheObjIter, capacity, get, get, getHitCount, getMissCount, getWithoutLock, isEmpty, isFull, isPruneExpiredActive, keySet, onRemove, put, putWithoutLock, removeWithoutLock, setListener, size, timeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, get, getAndRefresh, getAndRefreshpublic TimedCache(long ttl)
ttl - 超时(过期)时长,单位毫秒public TimedCache(long ttl,
Map<K,CacheObj<K,V>> map)
ttl - 过期时长,单位为毫秒map - 存储缓存对象的mappublic TimedCache(long ttl,
long cleanupMs)
ttl - 过期时长,单位为毫秒cleanupMs - 清理周期,单位为毫秒protected int pruneCache()
pruneCache in class AbstractCache<K extends Serializable,V extends Serializable>protected void schedulePrune(long delay)
delay - 间隔时长,单位毫秒public void cancelPruneSchedule()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2025. All rights reserved.