public class CacheEntry<T>
extends java.lang.Object
implements java.lang.Comparable
A cache entries "importance" is expressed by a "sample". The CacheEntry with the smallest sample is considered the least valuable.
This implementation supports a simple "most recently used" strategy.
Modifier | Constructor and Description |
---|---|
protected |
CacheEntry(java.lang.Object key,
T value)
Create a cache entry.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o) |
java.lang.Object |
getKey()
The key of the cache entry.
|
int |
getSample()
The sample representing the "importance" of the entry.
|
T |
getValue()
The value of the cache entry.
|
protected void |
touch()
Mark the Cache entry as recently used.
|
protected CacheEntry(java.lang.Object key, T value)
key
- The key for the entryvalue
- The value for the entrypublic int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public java.lang.Object getKey()
public int getSample()
public T getValue()
protected void touch()