K
- Hashable keyV
- Cached valueprotected abstract static class ExpiryCache.Node<K,V> extends java.lang.Object implements java.lang.Comparable<ExpiryCache.Node<K,V>>
access()
is
invoked. Subclasses of the enclosing class must subclass this inner class as part of
defining the policy of the cache. In particular Comparable.compareTo(Object)
must be
implemented to sort less desirable elements (those to be expired first) ahead of more
desirable elements (those to be retained longer).Modifier and Type | Field and Description |
---|---|
private K |
key
Hashable key
|
private V |
value
Cached value
|
Modifier | Constructor and Description |
---|---|
protected |
Node(K key,
V value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
access()
Increment the hit count for this node and record the timestamp of this access.
|
(package private) V |
accessValue()
Access the value, which updates the node with hit count and last access information.
|
abstract boolean |
equals(java.lang.Object o)
This method should be implemented to provide equivalence checking that is consistent
with a subclass' implementation of
compareTo(Node) . |
(package private) K |
getKey()
Get the key.
|
(package private) V |
getValue()
Get the value.
|
public abstract boolean equals(java.lang.Object o)
compareTo(Node)
.equals
in class java.lang.Object
o
- Object with which to compare this instance.true
if o
is equivalent to this instance, else
false
.K getKey()
V getValue()
V accessValue()
protected abstract void access()