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)
WeakHashLRU
add
in interface WeakHashLRU<K>
key
- Must not be nullpublic boolean contains(K key)
WeakHashLRU
contains
in interface WeakHashLRU<K>
key
- The key to search for, may not be nullpublic boolean remove(K key)
WeakHashLRU
remove
in interface WeakHashLRU<K>
key
- The key to remove, may not be nullpublic int size()
WeakHashLRU
size
in interface WeakHashLRU<K>
public K remove()
WeakHashLRU
remove
in interface WeakHashLRU<K>
public void releaseMatching(CacheKeyFilter<K> filter)
WeakHashLRU
releaseMatching
in interface WeakHashLRU<K>
filter
- A non-null filter that can be used
to delete every key that matches the filterpublic void clear()
WeakHashLRU
clear
in interface WeakHashLRU<K>
public void clearStaleReferences()
WeakHashLRU
clearStaleReferences
in interface WeakHashLRU<K>
Copyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.