K - 键类型V - 值类型public class LRUCache<K extends Serializable,V extends Serializable> extends ReentrantCache<K,V>
lockcacheMap, capacity, existCustomTimeout, hitCount, keyLockMap, listener, missCount, timeout| Constructor and Description |
|---|
LRUCache(int capacity)
构造
默认无超时 |
LRUCache(int capacity,
CacheListener<K,V> listener)
构造
默认无超时 |
LRUCache(int capacity,
long timeout)
构造
|
LRUCache(int capacity,
long timeout,
CacheListener<K,V> listener)
构造
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
pruneCache()
只清理超时对象,LRU的实现会交给
LinkedHashMap |
AbstractCache<K,V> |
setListener(CacheListener<K,V> listener)
设置监听
|
clear, containsKey, get, prune, put, remove, toStringcacheObjIter, capacity, get, get, getHitCount, getMissCount, getWithoutLock, isEmpty, isFull, isPruneExpiredActive, keySet, onRemove, put, putWithoutLock, removeWithoutLock, size, timeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, get, getAndRefresh, getAndRefreshpublic LRUCache(int capacity)
capacity - 容量public LRUCache(int capacity,
CacheListener<K,V> listener)
capacity - 容量listener - cache 监听器public LRUCache(int capacity,
long timeout)
capacity - 容量timeout - 默认超时时间,单位:毫秒public LRUCache(int capacity,
long timeout,
CacheListener<K,V> listener)
capacity - 容量timeout - 默认超时时间,单位:毫秒listener - cache 监听器public AbstractCache<K,V> setListener(CacheListener<K,V> listener)
AbstractCachesetListener in interface Cache<K extends Serializable,V extends Serializable>setListener in class AbstractCache<K extends Serializable,V extends Serializable>listener - 监听protected int pruneCache()
LinkedHashMappruneCache in class AbstractCache<K extends Serializable,V extends Serializable>Copyright © 2025. All rights reserved.