|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.coherence.weblogic.PortalCacheProvider.CacheImpl
protected class PortalCacheProvider.CacheImpl
Cache implementation that delegates most operations to a Coherence NamedCache.
This implementation does not support the ReloadableCache interface.
| Nested Class Summary | |
|---|---|
protected class |
PortalCacheProvider.CacheImpl.EntryInfoAn EntryInfo contains metadata about a cached Map.Entry. |
| Field Summary | |
|---|---|
protected NamedCache |
m_cacheThe Coherence NamedCache used to implement most cache operations. |
protected LocalCache |
m_cacheLocalThe LocalCache of non-serializable objects. |
protected boolean |
m_fEnabledEnabled flag. |
protected ConcurrentMap |
m_mapEntryInfoThe Map of EntryInfo objects for this CacheImpl. |
protected java.util.Set |
m_setLocalClassThe Set of non-serializable Class objects. |
protected java.lang.String |
m_sNameThe name of the cache. |
| Fields inherited from interface com.bea.p13n.cache.CacheDefaults |
|---|
DEFAULT_ENABLED, DEFAULT_MAX_ENTRIES, DEFAULT_TTL, MAX_ENTRIES_MAX, TTL_NEVER_EXPIRE |
| Constructor Summary | |
|---|---|
protected |
PortalCacheProvider.CacheImpl(java.lang.String sName, NamedCache cache)Create a new CacheImpl. |
| Method Summary | |
|---|---|
void |
clear()Remove all entries from the Cache. |
protected boolean |
compactEntryInfoMap(java.util.Map map, java.lang.Object oKey, PortalCacheProvider.CacheImpl.EntryInfo info)Remove the given EntryInfo from the specified Map if it is safe to do so. |
boolean |
containsKey(java.lang.Object oKey)Determine in an entry exists in the Cache. |
protected LocalCache |
ensureLocalCache()Return the LocalCache of non-serializable entries, creating it first if necessary. |
java.util.Set |
entrySet()Returns a Set view of the mappings contained in this cache. |
protected void |
flush(java.lang.Object oKey)Remove the entry with the given key from the EntryInfo Map and from the delegate NamedCache if it is a LocalCache. |
protected void |
flush(java.lang.Object oKey, boolean fFlushDelegate)Remove the entry with the given key from the EntryInfo Map. |
java.lang.Object |
get(java.lang.Object oKey)Return the cached value associated with the given key. |
protected PortalCacheProvider |
getCacheProvider()Return the PortalCacheProvider that created this CacheImpl |
protected java.lang.String |
getDescription()Return a string representation of this CacheImpl's attributes. |
protected ConcurrentMap |
getEntryInfoMap()Return the ConcurrentMap of EntryInfo objects for this CacheImpl. |
long |
getHitCount()Return the current Cache hit count. |
int |
getHitRate()Returns an integer percentage of Cache requests which returned a non-expired value. |
protected LocalCache |
getLocalCache()Return the LocalCache of non-serializable objects. |
protected java.util.Set |
getLocalClassSet()Return the Set of cached non-serializable classes. |
int |
getMaxEntries()Return the maximum number of entries the Cache can store. |
long |
getMissCount()Return the current Cache miss count. |
java.lang.String |
getName()Return the name of the Cache. |
protected NamedCache |
getNamedCache()Return the Coherence NamedCache used to implement most cache operations. |
com.bea.p13n.cache.CacheReloader |
getReloader(java.lang.Object oKey)Return the CacheReloader used for the given key or null if no CacheReloader is currently set. |
long |
getTtl()Get the default time-to-live, in milliseconds, of entries in the Cache. |
protected PortalCacheProvider.CacheImpl.EntryInfo |
instantiateEntryInfo(boolean fLocal)Factory pattern: Create a new EntryInfo. |
protected ConcurrentMap |
instantiateEntryInfoMap()Factory pattern: Create the Map used for concurrency control and to store EntryInfo objects for this CacheImpl. |
protected LocalCache |
instantiateLocalCache()Factory pattern: Create the LocalCache used to cache non-serializable entries |
boolean |
isEnabled()Return true if the Cache is enabled; false otherwise. |
java.util.Set |
keySet()Returns a Set view of the keys contained in this Cache. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue)Cache the given value. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue, com.bea.p13n.cache.CacheReloader reloader)Cache the given value and specify a CacheReloader used to reload the value when it expires. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue, long cMillis)Cache the given value with the specified time-to-live. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue, long cMillis, com.bea.p13n.cache.CacheReloader reloader)Cache the given value with a specific time-to-live and specify a CacheReloader used to reload the value when that time-to-live expires. |
protected java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue, long cMillis, PortalCacheProvider.CacheImpl.EntryInfo info, boolean fBlind)Cache the given value with the specified time-to-live in the delegate NamedCache. |
protected void |
release()Release all local resources associated with this CacheImpl instance. |
void |
reload(java.lang.Object oKey)Run the CacheReloader associated with the given key to refresh the value in the cache. |
java.lang.Object |
remove(java.lang.Object oKey)Remove an entry from the Cache if it exists. |
void |
resetStats()Reset all Cache statistics. |
void |
setEnabled(boolean fEnabled)Enable or disable the Cache. |
void |
setMaxEntries(int cEntries)Set the maximum number of entries the Cache can store. |
void |
setReloader(java.lang.Object oKey, com.bea.p13n.cache.CacheReloader reloader)Set the CacheReloader to be run when a cached object has expired. |
void |
setTtl(long cMillis)Set the default time-to-live for all entries in the Cache. |
int |
size()Return the size of the Cache. |
java.lang.String |
toString()Return a human readable description of this CacheImpl object. |
com.bea.p13n.cache.CacheReloader |
unsetReloader(java.lang.Object oKey)Remove the CacheReloader used for the given key. |
| Field Detail |
|---|
protected final java.lang.String m_sName
protected final NamedCache m_cache
protected final ConcurrentMap m_mapEntryInfo
protected final java.util.Set m_setLocalClass
protected LocalCache m_cacheLocal
protected volatile boolean m_fEnabled
| Constructor Detail |
|---|
protected PortalCacheProvider.CacheImpl(java.lang.String sName,
NamedCache cache)
sName - the name of the Cache; must not be nullcache - the delegate NamedCache; must not be null| Method Detail |
|---|
public com.bea.p13n.cache.CacheReloader getReloader(java.lang.Object oKey)
This method has no effect if the Cache is disabled (null is returned).
getReloader in interface com.bea.p13n.cache.ReloadableCacheoKey - the target key
public void setReloader(java.lang.Object oKey,
com.bea.p13n.cache.CacheReloader reloader)
When get() is called with the specified key and the entry has expired, the given CacheReloader is used to reload the object and refresh the Cache. Requests for cached objects without an associated CacheReloader will return null in this situation.
This method has no effect if the Cache is disabled.
setReloader in interface com.bea.p13n.cache.ReloadableCacheoKey - the key to add (or replace) the CacheReloader forreloader - the new CacheReloader (or null to remove the current CacheReloader)java.lang.IllegalArgumentException - if the Cache does not contain the keypublic com.bea.p13n.cache.CacheReloader unsetReloader(java.lang.Object oKey)
This method has no effect if the Cache is disabled (null is returned).
unsetReloader in interface com.bea.p13n.cache.ReloadableCacheoKey - the target key
public java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue,
com.bea.p13n.cache.CacheReloader reloader)
Neither the key nor the value may be null. The reloader may be null (in which case no CacheReloader is used and the value will expire in the "normal" way.)
put in interface com.bea.p13n.cache.ReloadableCacheoKey - key with which the specified value is to be cached; must not be nulloValue - value to cache; must not be nullreloader - the CacheReloader to associate with the given key
public java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue,
long cMillis,
com.bea.p13n.cache.CacheReloader reloader)
Neither the key nor the value may be null. The reloader may be null (in which case no CacheReloader is used and the value will expire in the "normal" way.)
put in interface com.bea.p13n.cache.ReloadableCacheoKey - key with which the specified value is to be cached; must not be nulloValue - value to cache; must not be nullcMillis - the time-to-live, in milliseconds, of the cached object; this TTL overrides the default TTL for the Cache, and applies only to the given keyreloader - the CacheReloader to associate with the given keypublic void reload(java.lang.Object oKey)
This method has no effect if the Cache is disabled.
reload in interface com.bea.p13n.cache.ReloadableCacheoKey - the target key
public java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue)
This method has no effect if the Cache is disabled (null is returned).
put in interface com.bea.p13n.cache.CacheoKey - the key of the entry to create; must not be nulloValue - the value to associate with the key; must not be null
public java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue,
long cMillis)
This method has no effect if the Cache is disabled (null is returned).
put in interface com.bea.p13n.cache.CacheoKey - the key of the entry to create; must not be nulloValue - the value to associate with the key; must not be nullcMillis - the time-to-live, in milliseconds, of the cached object; this TTL overrides the default TTL for the Cache, and applies only to the given keypublic java.lang.Object get(java.lang.Object oKey)
This method has no effect if the Cache is disabled (null is returned).
get in interface com.bea.p13n.cache.CacheoKey - the target key; must not be nullpublic void clear()
This method has no effect if the Cache is disabled (null is returned).
clear in interface com.bea.p13n.cache.Cachepublic java.lang.Object remove(java.lang.Object oKey)
This method has no effect if the Cache is disabled (null is returned).
remove in interface com.bea.p13n.cache.CacheoKey - the key of the entry to remove; must not be nullpublic int size()
If the Cache is disabled, -1 is returned.
size in interface com.bea.p13n.cache.Cachepublic java.util.Set keySet()
If the Cache is disabled, an empty immutable Set is returned.
keySet in interface com.bea.p13n.cache.Cachepublic java.util.Set entrySet()
If the Cache is disabled, an empty immutable Set is returned.
entrySet in interface com.bea.p13n.cache.Cachepublic boolean containsKey(java.lang.Object oKey)
If the Cache is disabled, false is returned.
containsKey in interface com.bea.p13n.cache.CacheoKey - the target key; must not be nullpublic long getTtl()
This method is unsupported (returns -1).
getTtl in interface com.bea.p13n.cache.Cachepublic void setTtl(long cMillis)
This method is unsupported and has no effect.
setTtl in interface com.bea.p13n.cache.CachecMillis - the new default time-to-live in millisecondspublic int getMaxEntries()
This method is unsupported (returns -1).
getMaxEntries in interface com.bea.p13n.cache.Cachepublic void setMaxEntries(int cEntries)
This method is unsupported and has no effect.
setMaxEntries in interface com.bea.p13n.cache.CachecEntries - the new maximum number of entriespublic java.lang.String getName()
getName in interface com.bea.p13n.cache.Cachepublic boolean isEnabled()
See the JavaDoc for the various Cache methods for a description of their behavior when the Cache is disabled.
isEnabled in interface com.bea.p13n.cache.Cachepublic void setEnabled(boolean fEnabled)
See the JavaDoc for the various Cache methods for a description of their behavior when the Cache is disabled.
setEnabled in interface com.bea.p13n.cache.CachefEnabled - true to enable the Cache; false to disable itpublic void resetStats()
This method is unsupported and has no effect.
resetStats in interface com.bea.p13n.cache.CacheStatspublic long getHitCount()
This method is unsupported (returns -1).
getHitCount in interface com.bea.p13n.cache.CacheStatspublic long getMissCount()
This method is unsupported (returns -1).
getMissCount in interface com.bea.p13n.cache.CacheStatspublic int getHitRate()
This method is unsupported (returns -1).
getHitRate in interface com.bea.p13n.cache.CacheStatspublic java.lang.String toString()
toString in interface com.bea.p13n.cache.Cacheprotected void release()
Releasing a CacheImpl reference makes it no longer usable; any attempt to use the reference may result in an exception.
protected java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue,
long cMillis,
PortalCacheProvider.CacheImpl.EntryInfo info,
boolean fBlind)
If a serialization error occurs during the put() operation, the given value will be cached in the LocalCache returned by ensureLocalCache() and a message will be logged.
This method is not thread safe.
oKey - the key of the entry to create; must not be nulloValue - the value to associate with the key; must not be nullcMillis - the time-to-live, in milliseconds, of the cached object; this TTL overrides the default TTL for the Cache, and applies only to the given keyinfo - the EntryInfo for the given keyfBlind - if true, a "blind" put() will be performed and null will be returnedprotected void flush(java.lang.Object oKey)
oKey - the optional key to flush; if null, the entire Cache will be flushed
protected void flush(java.lang.Object oKey,
boolean fFlushDelegate)
If the fFlushDelegate parameter is true, the remove or clear operation is also performed on the delegate NamedCache.
oKey - the optional key to flush; if null, the entire Cache will be flushedfFlushDelegate - if true, the remove or clear operation will also be performed on the delegate named cache
protected boolean compactEntryInfoMap(java.util.Map map,
java.lang.Object oKey,
PortalCacheProvider.CacheImpl.EntryInfo info)
This method is not thread safe.
map - the Map that contains the EntryInfooKey - the key used to store the EntryInfo in the given Mapinfo - the candidate EntryInfoprotected java.lang.String getDescription()
protected ConcurrentMap instantiateEntryInfoMap()
protected LocalCache instantiateLocalCache()
protected LocalCache ensureLocalCache()
protected PortalCacheProvider.CacheImpl.EntryInfo instantiateEntryInfo(boolean fLocal)
fLocal - if true, the corresponding Map.Entry is stored in the local Mapprotected PortalCacheProvider getCacheProvider()
protected NamedCache getNamedCache()
protected ConcurrentMap getEntryInfoMap()
protected java.util.Set getLocalClassSet()
protected LocalCache getLocalCache()
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||