public class WeakHashLRUImpl<K> extends Object implements WeakHashLRU<K>
| Constructor and Description |
|---|
WeakHashLRUImpl(boolean isWeak) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(K key)
Adds the given key to the LRU.
|
void |
clear()
Removes all entries from this LRU
|
void |
clearStaleReferences()
Causes stale references to be cleared from the data
structures.
|
boolean |
contains(K key)
Tells if the given key is in the LRU
|
void |
releaseMatching(CacheKeyFilter<K> filter)
Releases all keys that match the filter
|
K |
remove()
Removes the key that was Least
Recently Used
|
boolean |
remove(K key)
Removes the given key from the LRU, if found
|
int |
size()
Returns the number of elements currently
in the clock.
|
String |
toString() |
public void add(K key)
WeakHashLRUadd in interface WeakHashLRU<K>key - Must not be nullpublic boolean contains(K key)
WeakHashLRUcontains in interface WeakHashLRU<K>key - The key to search for, may not be nullpublic boolean remove(K key)
WeakHashLRUremove in interface WeakHashLRU<K>key - The key to remove, may not be nullpublic int size()
WeakHashLRUsize in interface WeakHashLRU<K>public K remove()
WeakHashLRUremove in interface WeakHashLRU<K>public void releaseMatching(CacheKeyFilter<K> filter)
WeakHashLRUreleaseMatching in interface WeakHashLRU<K>filter - A non-null filter that can be used
to delete every key that matches the filterpublic void clear()
WeakHashLRUclear in interface WeakHashLRU<K>public void clearStaleReferences()
WeakHashLRUclearStaleReferences in interface WeakHashLRU<K>Copyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.