K
- Hashable keyV
- Cached valueprivate static class LFUAgingCache.LFUEntry<K,V> extends Cache.Entry<K,V> implements java.lang.Comparable<Cache.Entry<K,V>>
Modifier and Type | Field and Description |
---|---|
private int |
hits
Hit count, the number of times this entry has been used/retrieved
|
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 entry identifier
|
Modifier and Type | Method and Description |
---|---|
private void |
access()
Increment the hit count for this entry and record the timestamp of this access.
|
int |
compareTo(Cache.Entry<K,V> n)
Compare this entry to another.
|
boolean |
equals(java.lang.Object o)
An implementation of equivalence checking consistent with
compareTo(Entry) . |
getKey, getValue
private static int nextID
private final int id
private int hits
private long lastAccess
public int compareTo(Cache.Entry<K,V> n)
This algorithm generally leaves the least desirable element first in the sorted result.
compareTo
in interface java.lang.Comparable<Cache.Entry<K,V>>
public boolean equals(java.lang.Object o)
compareTo(Entry)
.equals
in class java.lang.Object
o
- Object with which to compare this instance.true
if o
is equivalent to this instance, else
false
.private void access()