|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.services.cache.mru.AbstractMRUCache | +--org.sape.carbon.services.cache.mru.DefaultMRUCacheImpl
Extends AbsractMRUCache to provide the get method Copyright 2002 Sapient
Field Summary | |
protected MRUCacheDataLoader |
dataLoader
Holds the loader used to load this cache. |
private org.apache.commons.logging.Log |
log
The handle to Apache-commons logger |
Fields inherited from class org.sape.carbon.services.cache.mru.AbstractMRUCache |
cacheHits, cacheMisses, capacity, DEFAULT_ELEMENT_EXPIRATION_INTERVAL, expirationInterval, keyMap, map, MAX_EXPIRATION_TIME, name, ordering |
Constructor Summary | |
DefaultMRUCacheImpl()
|
Method Summary | |
void |
configure(ComponentConfiguration configuration)
Configures the component with a MRUCacheConfiguration . |
Object |
get(Object key)
For a given key value, return the object associated with the key value from the cache. |
Methods inherited from class org.sape.carbon.services.cache.mru.AbstractMRUCache |
clear, containsKey, containsValue, entrySet, getCacheHits, getCacheMisses, getCapacity, getExpirationInterval, getHitPercentage, getHits, getMisses, getObject, getSize, initialize, isEmpty, keySet, put, putAll, refreshAll, remove, removeLast, runScheduledTask, setCapacity, setExpirationInterval, size, toString, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
protected MRUCacheDataLoader dataLoader
private org.apache.commons.logging.Log log
Constructor Detail |
public DefaultMRUCacheImpl()
Method Detail |
public void configure(ComponentConfiguration configuration)
MRUCacheConfiguration
.
configure
in interface Configurable
configure
in class AbstractMRUCache
configuration
- MRUCacheConfiguration
used to
configure the component.Configurable.configure(ComponentConfiguration)
public Object get(Object key)
For a given key value, return the object associated with the key value from the cache. If the value is not found in the cache OR if the value in the cache has expired, the cache will attempt to load it from the DataLoader. If the DataLoader returns a null value, a null value will be stored in the cache and returned to the caller.
Unlike other methods on the MRUCache class, this method is not synchronized at the method level. It is, however, synchronized within the method. The purpose of this is to allow the cache to continue servicing requests while it is loading data from the DataLoader. All other activities in this method are synchronized, but the load of data from the MRUCacheDataLoader is unsycnchronized, and will not stop other threads from reading from the cache, or loading other datums.
key
- the key for the desired cache entry
Object
the cached object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |