K
- Hashable keyV
- Cached valueprivate static class LFUAgingCache.NodeImpl<K,V> extends ExpiryCache.Node<K,V>
Modifier and Type | Field and Description |
---|---|
private int |
hits
Hit count -- number of times this node has been retrieved from the cache
|
private int |
id
Internal identifier
|
private long |
lastAccess
Timestamp of last time this element was accessed (created or retrieved)
|
private static int |
nextID
Next available node identifier
|
Modifier and Type | Method and Description |
---|---|
protected void |
access()
Increment the hit count for this node and record the timestamp of this access.
|
int |
compareTo(ExpiryCache.Node<K,V> n)
Compare this node to another.
|
boolean |
equals(java.lang.Object o)
An implementation of equivalence checking consistent with
compareTo(Node) . |
accessValue, getKey, getValue
private static int nextID
private final int id
private int hits
private long lastAccess
public int compareTo(ExpiryCache.Node<K,V> n)
This algorithm generally leaves the least desirable element first in the sorted result.
public boolean equals(java.lang.Object o)
compareTo(Node)
.equals
in class ExpiryCache.Node<K,V>
o
- Object with which to compare this instance.true
if o
is equivalent to this instance, else
false
.protected void access()
access
in class ExpiryCache.Node<K,V>