K
- 键类型V
- 值类型public class LRUCache<K,V> extends AbstractCache<K,V>
cacheMap, capacity, existCustomTimeout, hitCount, keyLockMap, listener, missCount, timeout
Constructor and Description |
---|
LRUCache(int capacity)
构造
默认无超时 |
LRUCache(int capacity,
long timeout)
构造
|
Modifier and Type | Method and Description |
---|---|
protected int |
pruneCache()
只清理超时对象,LRU的实现会交给
LinkedHashMap |
cacheObjIterator, capacity, clear, containsKey, get, get, getHitCount, getMissCount, isEmpty, isFull, isPruneExpiredActive, iterator, keySet, onRemove, prune, put, put, remove, setListener, size, timeout, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public LRUCache(int capacity)
capacity
- 容量public LRUCache(int capacity, long timeout)
capacity
- 容量timeout
- 默认超时时间,单位:毫秒protected int pruneCache()
LinkedHashMap
pruneCache
in class AbstractCache<K,V>
Copyright © 2021. All rights reserved.