| 
 | Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.4.0) E17493-05 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoracle.ide.util.TimedCache<K,V>
OutOfMemoryError.  This class also makes use of a timer thread which
 stays running for the duration of the JVM, which is not appropriate
 for use at application runtime.  The map implementations
 provided by the Maps are typically a better
 solution, especially the memory sensitive implementations based on weak or
 soft references.
public final class TimedCache<K,V>
The TimedCache is an implementation of a cache that
 is based around an expiration timer.  The underlying data store
 of the cache is a HashMap, so objects are stored
 and retrieved from the cache using a (preferably immutable) key.
 Note that this implementation does not permit null keys.  Any use
 of a null key will result in a NullPointerException
 being thrown.
 When storing an object in the cache, an expiration delay should
 be specified which indicates how long that object will be stored
 in the cache, without being accessed, before it is removed from
 the cache.  The default expiration time, if none is specified,
 is 10 minutes per object.  As long as the object is accessed,
 via the get() method, the object will remain in
 the cache.  Expiration times can be specified on a per-object
 basis.  The value NEVER_EXPIRES, as the name implies,
 can also be specified to prevent expiration of the object. 
| Field Summary | |
|---|---|
| static int | DEFAULT_EXPIRATIONDeprecated. The default expiration (in minutes) for an instance of a timer cache that was created without a specified expiration. | 
| static int | MAXIMUM_EXPIRATIONDeprecated. The maximum expiration (in minutes) that can be set on any object or as the default. | 
| static int | NEVER_EXPIRESDeprecated. The constant to specify in place of an expiration time to indicate that the given object should never expire. | 
| Constructor Summary | |
|---|---|
| TimedCache()Deprecated. Constructs a new, empty TimedCacheinstance
 with default expiration on objects added to the cache. | |
| TimedCache(int defaultExpiration)Deprecated. Constructs a new, empty TimedCacheinstance
 with the specified default expiration on objects added to the cache
 without an expiration time. | |
| Method Summary | ||
|---|---|---|
|  void | clear()Deprecated. Clears the contents of this cache. | |
|  V | get(K key)Deprecated. Retrieves a previously cached object from the cache. | |
| static
 | newInstance()Deprecated. Static factory method to create a new TimedCacheinstance with
 the default expiration time, capacity, and load factor. | |
| static
 | newInstance(int defaultExpiration)Deprecated. Static factory method to create a new TimedCacheinstance with
 the deafult capacity and load factor. | |
| static
 | newInstance(int defaultExpiration,
            int initialCapacity,
            float loadFactor)Deprecated. Static factory method to create a new TimedCacheinstance. | |
|  void | put(K key,
    V value)Deprecated. Stores an object into the cache. | |
|  void | put(K key,
    V value,
    int expiration)Deprecated. Stores an object into the cache. | |
|  V | remove(K key)Deprecated. Removes the mapping for this key from the cache if present. | |
|  void | setDefaultExpiration(int defaultExpiration)Deprecated. Changes the default expiration used by the cache for objects stored in the cache without an explicit expiration. | |
|  void | setExpiration(K key,
              int expiration)Deprecated. Changes the expiration on a previously cached object. | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int DEFAULT_EXPIRATION
public static final int MAXIMUM_EXPIRATION
public static final int NEVER_EXPIRES
TimedCache instance.
| Constructor Detail | 
|---|
public TimedCache()
TimedCache instance
 with default expiration on objects added to the cache.
public TimedCache(int defaultExpiration)
TimedCache instance
 with the specified default expiration on objects added to the cache
 without an expiration time.
defaultExpiration - the expiration (in minutes) to set by
        default, or DEFAULT_EXPIRATION for the default, or
        NEVER_EXPIRES| Method Detail | 
|---|
public static <K,V> TimedCache<K,V> newInstance()
TimedCache instance with
 the default expiration time, capacity, and load factor.
public static <K,V> TimedCache<K,V> newInstance(int defaultExpiration)
TimedCache instance with
 the deafult capacity and load factor.
defaultExpiration - the expiration (in minutes) to set by
        default, or DEFAULT_EXPIRATION for the default, or
        NEVER_EXPIRES
public static <K,V> TimedCache<K,V> newInstance(int defaultExpiration,
                                                int initialCapacity,
                                                float loadFactor)
TimedCache instance.
defaultExpiration - the expiration (in minutes) to set by
        default, or DEFAULT_EXPIRATION for the default, or
        NEVER_EXPIRESinitialCapacity - the initial capacity of the cacheloadFactor - the load factor of the cache
public V get(K key)
key - the search key for locating the cached object
public void put(K key,
                V value)
key - the search key for determing the storage locationvalue - the object to store
public void put(K key,
                V value,
                int expiration)
key - the search key for determing the storage locationvalue - the object to storeexpiration - the new expiration time in minutes to set,
                   or DEFAULT_EXPIRATION for the default, or
                   NEVER_EXPIRESpublic V remove(K key)
key - the key for looking up the cache object to remove
null if no there was no mapping for the keypublic void setDefaultExpiration(int defaultExpiration)
defaultExpiration - the expiration (in minutes) to set by
        default, or DEFAULT_EXPIRATION for the default, or
        NEVER_EXPIRES
public void setExpiration(K key,
                          int expiration)
key - the search key for locating the cached objectexpiration - the new expiration time in minutes to set,
                   or DEFAULT_EXPIRATION for the default, or
                   NEVER_EXPIRESpublic void clear()
| 
 | Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.4.0) E17493-05 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||