|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.jdeveloper.java.util.TimedLRUCache
public class TimedLRUCache
The TimedLRUCache
is a timed and LRU cache that discards least-recently-used excess or expired cached entries. The cache checks for these excess or expired cache entries only at periodic intervals so as not to be overly aggressive about pruning the cache.
Clients have to specify the size of the cache - when the cache exceeds this specified size, least-recently-used cached entries will be discarded automatically.
Clients can also specify an optional time-to-live expiration for entries. Cached entries that have not been accessed within that timeframe will also be discarded automatically. The minimum expiration time that can be specified is defined by MINIMUM_EXPIRATION
which is currently 60 seconds. Clients can also specify that entries should never expire by specifying NO_EXPIRATION
.
This cache does not support null keys, or null values.
Field Summary | |
---|---|
static int |
MINIMUM_EXPIRATION The smallest expiration time (milliseconds) this cache will used. |
static int |
NO_EXPIRATION Constant indicating that the cache does not have an expiration policy based on time. |
Constructor Summary | |
---|---|
TimedLRUCache(int maxSize) Constructs a new TimedLRUCache with the given max size. |
|
TimedLRUCache(int maxSize, int timeToLiveMillis) Construct a new TimedLRUCache with the given max size and time-to-live for the entries. |
Method Summary | |
---|---|
protected void |
checkForExpiration() Checks for expiration in the cache, whether it is least-recently used or timer based. |
protected boolean |
containsKey(java.lang.Object key) Checks whether the cache contains the given key. |
java.lang.Object |
get(java.lang.Object key) Fetches an object from the cache for the given key. |
void |
put(java.lang.Object key, java.lang.Object value) Stores an object into the cache under the given key. |
java.lang.Object |
remove(java.lang.Object key) Removes an object from the cache using the given lookup key. |
protected int |
size() Fetches the size of the cache currently. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_EXPIRATION
public static final int MINIMUM_EXPIRATION
Constructor Detail |
---|
public TimedLRUCache(int maxSize)
TimedLRUCache
with the given max size.
maxSize
- the maximum size of the cachepublic TimedLRUCache(int maxSize, int timeToLiveMillis)
TimedLRUCache
with the given max size and time-to-live for the entries.
maxSize
- the maximum size of the cachetimeToLiveMillis
- the time-to-live for the entries (milliseconds)Method Detail |
---|
public java.lang.Object get(java.lang.Object key)
key
- the key of the entry to lookuppublic void put(java.lang.Object key, java.lang.Object value)
key
- the key to store the value undervalue
- the value to store with the keypublic java.lang.Object remove(java.lang.Object key)
key
- the key to use for looking up the objectprotected boolean containsKey(java.lang.Object key)
protected int size()
protected void checkForExpiration()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |