Package de.intarsys.tools.cache
Class CacheEntry<T>
java.lang.Object
de.intarsys.tools.cache.CacheEntry<T>
- All Implemented Interfaces:
Comparable
An entry in the cache implementation.
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.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CacheEntry
Create a cache entry.- Parameters:
key
- The key for the entryvalue
- The value for the entry
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T>
-
getKey
The key of the cache entry.- Returns:
- Returns the key.
-
getSample
public int getSample()The sample representing the "importance" of the entry.- Returns:
- Returns the sample.
-
getValue
The value of the cache entry.- Returns:
- Returns the value.
-
touch
protected void touch()Mark the Cache entry as recently used.
-