Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.util
Class Maps.BoundedLruCacheStrategy<K,V,E extends Maps.AbstractLinkedEntry<K,V>>

java.lang.Object
  extended by oracle.javatools.util.Maps.CacheStrategy<K,V,E>
      extended by oracle.javatools.util.Maps.BoundedLruCacheStrategy<K,V,E>
Enclosing class:
Maps

public static class Maps.BoundedLruCacheStrategy<K,V,E extends Maps.AbstractLinkedEntry<K,V>>
extends Maps.CacheStrategy<K,V,E>

A bounded size LRU cache strategy.

See Also:
Maps.AbstractCacheMap, Maps.CacheStrategy

Field Summary
 
Fields inherited from class oracle.javatools.util.Maps.CacheStrategy
CANONICAL, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, HARD, NONCANONICAL, SOFT, WEAK
 
Constructor Summary
Maps.BoundedLruCacheStrategy(int maximumSize)
          Constructs a bounded LRU (least recently used), hard-referenced value, canonically mapped cache strategy.
Maps.BoundedLruCacheStrategy(int maximumSize, int initialCapacity, float loadFactor, Maps.AbstractCacheMap.ReferenceType valueReferenceType, Maps.AbstractCacheMap.MappingType mappingType)
          Constructs an unbounded cache strategy.
 
Method Summary
protected  boolean evictEldest(Maps.AbstractCacheMap<K,V,E> map, E eldest)
          Gets whether to evict the eldest entry from a cache.
 
Methods inherited from class oracle.javatools.util.Maps.CacheStrategy
entryAccessed, entryAdded, entryChanged, entryEvicted, entryPurged, entryRemoved, getInitialCapacity, getLoadFactor, getMappingType, getValueReferenceType, mapChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Maps.BoundedLruCacheStrategy

public Maps.BoundedLruCacheStrategy(int maximumSize)
Constructs a bounded LRU (least recently used), hard-referenced value, canonically mapped cache strategy. The initial capacity and load factor are set to maximumSize+1 and 1.0f, respectively, which ensures that the map will not have to resize before reaching its maximum size.

Parameters:
maximumSize - The maximum number of entries allowed in the map.

Maps.BoundedLruCacheStrategy

public Maps.BoundedLruCacheStrategy(int maximumSize,
                                    int initialCapacity,
                                    float loadFactor,
                                    Maps.AbstractCacheMap.ReferenceType valueReferenceType,
                                    Maps.AbstractCacheMap.MappingType mappingType)
Constructs an unbounded cache strategy.

Method Detail

evictEldest

protected boolean evictEldest(Maps.AbstractCacheMap<K,V,E> map,
                              E eldest)
Gets whether to evict the eldest entry from a cache. Invoked when an entry is added to the map, after Maps.CacheStrategy.entryAdded(oracle.javatools.util.Maps.AbstractCacheMap, E) is invoked, but not if Maps.CacheStrategy.entryAdded(oracle.javatools.util.Maps.AbstractCacheMap, E) modifies the map.

The Maps.CacheStrategy implementation returns false.

The Maps.BoundedLruCacheStrategy implementation returns true if the added value has caused the map to exceed the maximum size.

Overrides:
evictEldest in class Maps.CacheStrategy<K,V,E extends Maps.AbstractLinkedEntry<K,V>>
eldest - The eldest entry in the map, potentially to be evicted.
Returns:
whether the eldest entry should be evicted.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.