public static class Maps.TimedLruCacheStrategy<K,V> extends Maps.BoundedLruCacheStrategy<K,V>
A synchronous timed cache evicts expired entries whenever standard map methods are invoked by clients. Locking issues are assumed to be handled by clients.
 An asynchronous timed cache additionally evicts expired entries
 periodically from a background thread owned by the strategy. On that
 thread, the strategy must handle the locking, so the strategy requires
 that a lock object be passed to the constructor. To protect its invocation
 of periodicTaskExecuted(oracle.javatools.util.Maps.CacheMap<K, V>), if the lock object implements Lock, then the strategy uses Lock.lock() and Lock.unlock();
 otherwise the strategy uses the object monitor lock (it synchronizes on
 the object).
Maps.CacheMap, 
Maps.CacheStrategy, 
Serialized FormCANONICAL, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, NOT_CANONICAL, SOFT, STRONG, WEAK| Constructor and Description | 
|---|
TimedLruCacheStrategy(int time)
Constructs a timed, synchronous, unbounded, canonical cache strategy of 
 strongly-referenced values. 
 | 
TimedLruCacheStrategy(int time,
                     int bound)
Constructs a timed, synchronous, bounded LRU (least recently used), 
 canonical cache strategy of strongly-referenced values. 
 | 
TimedLruCacheStrategy(int time,
                     int bound,
                     int initialCapacity,
                     float loadFactor,
                     Maps.CacheMap.Canonicity canonicity,
                     Maps.CacheMap.Strength strength)
Constructs a timed, synchronous, bounded LRU (least recently used) cache 
 strategy. 
 | 
TimedLruCacheStrategy(int time,
                     int period,
                     java.lang.Object lock)
Constructs a timed, asynchronous, unbounded, canonical cache strategy of 
 strongly-referenced values. 
 | 
TimedLruCacheStrategy(int time,
                     int period,
                     java.lang.Object lock,
                     int bound)
Constructs a timed, asynchronous, bounded LRU (least recently used), 
 canonical cache strategy of strongly-referenced values. 
 | 
TimedLruCacheStrategy(int time,
                     int period,
                     java.lang.Object lock,
                     int bound,
                     int initialCapacity,
                     float loadFactor,
                     Maps.CacheMap.Canonicity canonicity,
                     Maps.CacheMap.Strength strength)
Constructs a timed, bounded LRU (least recently used) cache strategy. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected Maps.LinkedEntry<K,V> | 
createDefaultEntry(int hashCode,
                  K key,
                  V value,
                  Maps.LinkedEntry<K,V> next)  | 
protected Maps.LinkedEntry<K,V> | 
createEvictedEntry(int hashCode,
                  K key,
                  V value,
                  Maps.LinkedEntry<K,V> next,
                  java.lang.ref.ReferenceQueue<V> queue)  | 
protected Maps.LinkedEntry<K,V> | 
createSoftEntry(int hashCode,
               K key,
               V value,
               Maps.LinkedEntry<K,V> next,
               java.lang.ref.ReferenceQueue<V> queue)  | 
protected Maps.LinkedEntry<K,V> | 
createWeakEntry(int hashCode,
               K key,
               V value,
               Maps.LinkedEntry<K,V> next,
               java.lang.ref.ReferenceQueue<V> queue)  | 
protected void | 
entryAccessed(Maps.CacheMap<K,V> map,
             Maps.LinkedEntry<K,V> entry)
Invoked when the value of an existing entry is accessed by  
Maps.AbstractHashMap.get(java.lang.Object). | 
protected void | 
entryAdded(Maps.CacheMap<K,V> map,
          Maps.LinkedEntry<K,V> entry)
Invoked when a new entry is added to this map, when entries are added
 by  
Maps.AbstractHashMap.put(K, V). | 
protected void | 
entryChanged(Maps.CacheMap<K,V> map,
            Maps.LinkedEntry<K,V> oldEntry,
            V oldValue,
            Maps.LinkedEntry<K,V> newEntry)
Invoked when the value of an existing entry is changed or when entries 
 are changed by  
Maps.AbstractHashMap.put(K, V). | 
protected void | 
entryEvicted(Maps.CacheMap<K,V> map,
            Maps.LinkedEntry<K,V> entry)
Invoked when an existing entry is evicted by  
Maps.AbstractLinkedHashMap.evictEntry(E). | 
protected void | 
entryPurged(Maps.CacheMap<K,V> map,
           Maps.LinkedEntry<K,V> entry)
Invoked when an existing entry is purged after its value has been 
 garbage collected. 
 | 
protected void | 
entryRemoved(Maps.CacheMap<K,V> map,
            Maps.LinkedEntry<K,V> entry)
Invoked when an existing entry is removed by a remove
 method of this map, of a view collection of this map, or of an iterator
 of a view collection of this map 
 | 
protected void | 
evictExpiredEntries(Maps.CacheMap<K,V> map)
Evict expired entries from the  
Maps.CacheMap}. | 
protected void | 
mapConstructed(Maps.CacheMap<K,V> map)
Invoked when the map has constructed. 
 | 
protected void | 
periodicTaskExecuted(Maps.CacheMap<K,V> map)
Invoked when the periodic timer expires. 
 | 
createEntry, getCanonicity, getDefaultStrength, getInitialCapacity, getLoadFactor, mapChangedpublic TimedLruCacheStrategy(int time)
time - The maximum age (ms) of entries allowed in the cache.public TimedLruCacheStrategy(int time,
                             int period,
                             java.lang.Object lock)
time - The maximum age (ms) of entries allowed in the cache.period - The period (ms) of asynchronous eviction.lock - The lock to use for asynchronous eviction.public TimedLruCacheStrategy(int time,
                             int bound)
time - The maximum age (ms) of entries allowed in the cache.bound - The maximum number of entries allowed in the cache.public TimedLruCacheStrategy(int time,
                             int period,
                             java.lang.Object lock,
                             int bound)
time - The maximum age (ms) of entries allowed in the cache.period - The period (ms) of asynchronous eviction.lock - The lock to use for asynchronous eviction.bound - The maximum number of entries allowed in the cache.public TimedLruCacheStrategy(int time,
                             int bound,
                             int initialCapacity,
                             float loadFactor,
                             Maps.CacheMap.Canonicity canonicity,
                             Maps.CacheMap.Strength strength)
time - The maximum age (ms) of entries allowed in the cache.bound - The maximum number of entries allowed in the cache.initialCapacity - The initial capacity (see Maps.CacheStrategy.DEFAULT_INITIAL_CAPACITY).loadFactor - The load factor (see Maps.CacheStrategy.DEFAULT_LOAD_FACTOR).canonicity - Canonicity of this cache.strength - The strength of value references.public TimedLruCacheStrategy(int time,
                             int period,
                             java.lang.Object lock,
                             int bound,
                             int initialCapacity,
                             float loadFactor,
                             Maps.CacheMap.Canonicity canonicity,
                             Maps.CacheMap.Strength strength)
time - The maximum age (ms) of entries allowed in the cache.period - The period (ms) of asynchronous eviction.lock - The lock to use for asynchronous eviction.bound - The maximum number of entries allowed in the cache.initialCapacity - The initial capacity (see Maps.CacheStrategy.DEFAULT_INITIAL_CAPACITY).loadFactor - The load factor (see Maps.CacheStrategy.DEFAULT_LOAD_FACTOR).canonicity - Canonicity of this cache.strength - The strength of value references.protected void mapConstructed(Maps.CacheMap<K,V> map)
 The Maps.CacheStrategy implementation does nothing.
 The default Maps.TimedLruCacheStrategy implementation adds the newly
 constructed map to the list of maps to be serviced, and ensures that
 a periodic task is scheduled to service the map. 
 
 The periodic task, when invoked, evicts expired entries using evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>). Once all the maps to be serviced are garbage
 collected, the task cancels itself.
mapConstructed in class Maps.CacheStrategy<K,V>protected Maps.LinkedEntry<K,V> createDefaultEntry(int hashCode, K key, V value, Maps.LinkedEntry<K,V> next)
createDefaultEntry in class Maps.CacheStrategy<K,V>protected Maps.LinkedEntry<K,V> createSoftEntry(int hashCode, K key, V value, Maps.LinkedEntry<K,V> next, java.lang.ref.ReferenceQueue<V> queue)
createSoftEntry in class Maps.CacheStrategy<K,V>protected Maps.LinkedEntry<K,V> createWeakEntry(int hashCode, K key, V value, Maps.LinkedEntry<K,V> next, java.lang.ref.ReferenceQueue<V> queue)
createWeakEntry in class Maps.CacheStrategy<K,V>protected Maps.LinkedEntry<K,V> createEvictedEntry(int hashCode, K key, V value, Maps.LinkedEntry<K,V> next, java.lang.ref.ReferenceQueue<V> queue)
createEvictedEntry in class Maps.CacheStrategy<K,V>protected void evictExpiredEntries(Maps.CacheMap<K,V> map)
Maps.CacheMap}.
 
 The Maps.TimedLruCacheStrategy implementation removes LRU entries
 with a time older than maximumAge before the current time.
protected void periodicTaskExecuted(Maps.CacheMap<K,V> map)
 The Maps.TimedLruCacheStrategy implementation purges the map and
 invokes evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
protected void entryAdded(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
Maps.AbstractHashMap.put(K, V).
 
 The Maps.CacheStrategy implementation does nothing.
 The Maps.BoundedLruCacheStrategy implementation evicts the eldest
 entry in the map if the size of the map after the add exceeds the 
 maximum size.
 The Maps.TimedLruCacheStrategy implementation delegates to 
 evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
entryAdded in class Maps.BoundedLruCacheStrategy<K,V>protected void entryChanged(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> oldEntry, V oldValue, Maps.LinkedEntry<K,V> newEntry)
Maps.AbstractHashMap.put(K, V).
 
 If the entry to change was mutable, its value is changed with Map.Entry#setValue and oldEntry and newEntry are the
 same object. If the entry to change was not mutable, a new entry
 must be created and oldEntry and newEntry are
 different objects.
 When a client directly invokes the Map.Entry#setValue method of
 any of the Map.Entry implementations provided in this class,
 this method is not invoked (while this could be addressed, it would
 require each entry instance to hold a reference to its map).
 The Maps.CacheStrategy implementation does nothing.
 The Maps.TimedLruCacheStrategy implementation delegates to 
 evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
entryChanged in class Maps.CacheStrategy<K,V>oldEntry - The existing entry that changed.oldValue - The old value of the entry.newEntry - The new entry, which may be the same as the old.protected void entryAccessed(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
Maps.AbstractHashMap.get(java.lang.Object). Access to an entry by iterating a view collection of this 
 map does not cause this method to be invoked.
 
 The Maps.CacheStrategy implementation does nothing.
 The Maps.TimedLruCacheStrategy implementation delegates to 
 evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
entryAccessed in class Maps.CacheStrategy<K,V>protected void entryRemoved(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
 The Maps.CacheMap implementation never invokes Maps.CacheStrategy.entryRemoved(oracle.javatools.util.Maps.CacheMap<K, V>, oracle.javatools.util.Maps.LinkedEntry<K, V>) 
 when entries are removed by the Maps.CacheMap.clear() method of this
 map, or of a view collection of this map.
 The Maps.CacheStrategy implementation does nothing.
 The Maps.TimedLruCacheStrategy implementation delegates to 
 evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
entryRemoved in class Maps.CacheStrategy<K,V>protected void entryPurged(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
 The Maps.CacheMap implementation only ever invokes Maps.CacheStrategy.entryPurged(oracle.javatools.util.Maps.CacheMap<K, V>, oracle.javatools.util.Maps.LinkedEntry<K, V>) for entries which extend SoftReference or
 WeakReference and which register themselves with the
 ReferenceQueue returned by Maps.AbstractHashMap.getQueue(). 
 Maps provides four such classes: Maps.SoftEntry, 
 Maps.WeakEntry, Maps.SoftLinkedEntry, and Maps.WeakLinkedEntry.
 The Maps.CacheStrategy implementation does nothing.
 The Maps.TimedLruCacheStrategy implementation delegates to 
 evictExpiredEntries(oracle.javatools.util.Maps.CacheMap<K, V>).
entryPurged in class Maps.CacheStrategy<K,V>protected void entryEvicted(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
Maps.AbstractLinkedHashMap.evictEntry(E). 
 
 If this map is canonical, eviction means the entry was converted to a 
 weak reference and Maps.CacheStrategy.mapChanged(oracle.javatools.util.Maps.CacheMap<K, V>) was not invoked. If the  
 map is not canonical, eviction means the entry was removed and 
 Maps.CacheStrategy.mapChanged(oracle.javatools.util.Maps.CacheMap<K, V>) was invoked.
 
 The Maps.CacheStrategy implementation does nothing.
 The Maps.TimedLruCacheStrategy implementation does nothing.
entryEvicted in class Maps.CacheStrategy<K,V>