01: package ri.cache.eviction;
02:
03: import javax.cache.CacheEntry;
04:
05: public abstract class AbstractEvictionStrategy<K, V> implements
06: EvictionStrategy<K, V> {
07:
08: public CacheEntry<K, V> createEntry(K key, V value, long ttl) {
09: return new Entry<K, V>(key, value, ttl);
10: }
11:
12: public void touchEntry(CacheEntry<K, V> entry) {
13: ((AbstractCacheEntry<K, V>) entry).touch();
14: }
15:
16: public void discardEntry(CacheEntry<K, V> entry) {
17: ((AbstractCacheEntry<K, V>) entry).discard();
18: }
19:
20: public void clear() {
21: }
22:
23: private static class Entry<K, V> extends AbstractCacheEntry<K, V> {
24: private Entry(K key, V value, long ttl) {
25: super (key, value, ttl);
26: }
27:
28: public void discard() {
29: }
30: }
31:
32: }
|