| Modifier and Type | Field and Description |
|---|---|
| private final WeakHashMap | |
| private final ConcurrentHashMap | |
| private final boolean | |
| private final ReentrantLock | |
| private DoubleNode | |
| private DoubleNode | |
| private final ReferenceQueue | |
| private static final Object |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(K key)
Implements org. Adds the given key to the LRU. |
| private DoubleNode | |
| public void | clear()
Implements org. Removes all entries from this LRU |
| private void | |
| public void | clearStaleReferences()
Implements org. Causes stale references to be cleared from the data structures. |
| public boolean | contains(K key)
Implements org. Tells if the given key is in the LRU |
| public void | releaseMatching(CacheKeyFilter<K> filter)
Implements org. Releases all keys that match the filter |
| private K | remove(DoubleNode<K, Object> removeMe)
Implements org. Removes the given key from the LRU, if found |
| public boolean | remove(K key)
Implements org. Removes the given key from the LRU, if found |
| public K | remove()
Implements org. Removes the key that was Least Recently Used |
| private boolean | |
| public int | size()
Implements org. Returns the number of elements currently in the clock. |
| public String |
| byKey | back to summary |
|---|---|
| private final WeakHashMap<K, DoubleNode<K, Object>> byKey | |
| byKeyNotWeak | back to summary |
|---|---|
| private final ConcurrentHashMap<K, DoubleNode<K, Object>> byKeyNotWeak | |
| isWeak | back to summary |
|---|---|
| private final boolean isWeak | |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock | |
| lru | back to summary |
|---|---|
| private DoubleNode<K, Object> lru | |
| mru | back to summary |
|---|---|
| private DoubleNode<K, Object> mru | |
| myQueue | back to summary |
|---|---|
| private final ReferenceQueue<? super K> myQueue | |
| VALUE | back to summary |
|---|---|
| private static final Object VALUE | |
| WeakHashLRUImpl | back to summary |
|---|---|
| public WeakHashLRUImpl(boolean isWeak) | |
| add | back to summary |
|---|---|
| public void add(K key) Implements org. Doc from org. Adds the given key to the LRU. It will be placed at the MRU of the LRU. If this key already exists in the LRU it will be moved to the MRU
| |
| addToHead | back to summary |
|---|---|
| private DoubleNode | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Doc from org. Removes all entries from this LRU
| |
| clearStale | back to summary |
|---|---|
| private void clearStale() | |
| clearStaleReferences | back to summary |
|---|---|
| public void clearStaleReferences() Implements org. Doc from org. Causes stale references to be cleared from the data structures. Since this is a weak clock the references can go away at any time, which happens whenever any operation has been performed. However, it may be the case that no operation will be performed for a while and so this method is provided to have a no-op operation to call in order to clear out any stale references
| |
| contains | back to summary |
|---|---|
| public boolean contains(K key) Implements org. Doc from org. Tells if the given key is in the LRU
| |
| releaseMatching | back to summary |
|---|---|
| public void releaseMatching(CacheKeyFilter<K> filter) Implements org. Doc from org. Releases all keys that match the filter
| |
| remove | back to summary |
|---|---|
| private K remove(DoubleNode<K, Object> removeMe) Implements org. Doc from org. Removes the given key from the LRU, if found | |
| remove | back to summary |
|---|---|
| public boolean remove(K key) Implements org. Doc from org. Removes the given key from the LRU, if found
| |
| remove | back to summary |
|---|---|
| public K remove() Implements org. Doc from org. Removes the key that was Least Recently Used
| |
| removeNoClear | back to summary |
|---|---|
| private boolean removeNoClear(K key) | |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from org. Returns the number of elements currently in the clock. References that have gone away because they were weakly referenced will not be counted in the size
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |