|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
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.EntryInfo
An EntryInfo contains metadata about a cached Map.Entry. |
Field Summary | |
---|---|
protected NamedCache |
m_cache
The Coherence NamedCache used to implement most cache operations. |
protected LocalCache |
m_cacheLocal
The LocalCache of non-serializable objects. |
protected boolean |
m_fEnabled
Enabled flag. |
protected ConcurrentMap |
m_mapEntryInfo
The Map of EntryInfo objects for this CacheImpl. |
protected Set |
m_setLocalClass
The Set of non-serializable Class objects. |
protected String |
m_sName
The 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(String sName,
NamedCache cache)
Create a new CacheImpl. |
Method Summary | |
---|---|
void |
clear()
Remove all entries from the Cache. |
protected boolean |
compactEntryInfoMap(Map map,
Object oKey,
PortalCacheProvider.CacheImpl.EntryInfo info)
Remove the given EntryInfo from the specified Map if it is safe to do so. |
boolean |
containsKey(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. |
Set |
entrySet()
Returns a Set view of the mappings contained in this cache. |
protected void |
flush(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(Object oKey,
boolean fFlushDelegate)
Remove the entry with the given key from the EntryInfo Map. |
Object |
get(Object oKey)
Return the cached value associated with the given key. |
protected PortalCacheProvider |
getCacheProvider()
Return the PortalCacheProvider that created this CacheImpl |
protected 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 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. |
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(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. |
Set |
keySet()
Returns a Set view of the keys contained in this Cache. |
Object |
put(Object oKey,
Object oValue)
Cache the given value. |
Object |
put(Object oKey,
Object oValue,
com.bea.p13n.cache.CacheReloader reloader)
Cache the given value and specify a CacheReloader used to reload the value when it expires. |
Object |
put(Object oKey,
Object oValue,
long cMillis)
Cache the given value with the specified time-to-live. |
Object |
put(Object oKey,
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 Object |
put(Object oKey,
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(Object oKey)
Run the CacheReloader associated with the given key to refresh the value in the cache. |
Object |
remove(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(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. |
String |
toString()
Return a human readable description of this CacheImpl object. |
com.bea.p13n.cache.CacheReloader |
unsetReloader(Object oKey)
Remove the CacheReloader used for the given key. |
Field Detail |
---|
protected final String m_sName
protected final NamedCache m_cache
protected final ConcurrentMap m_mapEntryInfo
protected final Set m_setLocalClass
protected LocalCache m_cacheLocal
protected volatile boolean m_fEnabled
Constructor Detail |
---|
protected PortalCacheProvider.CacheImpl(String sName, NamedCache cache)
sName
- the name of the Cache; must not be nullcache
- the delegate NamedCache; must not be nullMethod Detail |
---|
public com.bea.p13n.cache.CacheReloader getReloader(Object oKey)
getReloader
in interface com.bea.p13n.cache.ReloadableCache
oKey
- the target key
public void setReloader(Object oKey, com.bea.p13n.cache.CacheReloader reloader)
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.ReloadableCache
oKey
- the key to add (or replace) the CacheReloader forreloader
- the new CacheReloader (or null to remove the current
CacheReloader)
IllegalArgumentException
- if the Cache does not contain the keypublic com.bea.p13n.cache.CacheReloader unsetReloader(Object oKey)
unsetReloader
in interface com.bea.p13n.cache.ReloadableCache
oKey
- the target key
public Object put(Object oKey, Object oValue, com.bea.p13n.cache.CacheReloader reloader)
put
in interface com.bea.p13n.cache.ReloadableCache
oKey
- 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 Object put(Object oKey, Object oValue, long cMillis, com.bea.p13n.cache.CacheReloader reloader)
put
in interface com.bea.p13n.cache.ReloadableCache
oKey
- 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 key
public void reload(Object oKey)
reload
in interface com.bea.p13n.cache.ReloadableCache
oKey
- the target keypublic Object put(Object oKey, Object oValue)
put
in interface com.bea.p13n.cache.Cache
oKey
- the key of the entry to create; must not be nulloValue
- the value to associate with the key; must not be null
public Object put(Object oKey, Object oValue, long cMillis)
put
in interface com.bea.p13n.cache.Cache
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 key
public Object get(Object oKey)
get
in interface com.bea.p13n.cache.Cache
oKey
- the target key; must not be null
public void clear()
clear
in interface com.bea.p13n.cache.Cache
public Object remove(Object oKey)
remove
in interface com.bea.p13n.cache.Cache
oKey
- the key of the entry to remove; must not be null
public int size()
size
in interface com.bea.p13n.cache.Cache
public Set keySet()
keySet
in interface com.bea.p13n.cache.Cache
public Set entrySet()
entrySet
in interface com.bea.p13n.cache.Cache
public boolean containsKey(Object oKey)
containsKey
in interface com.bea.p13n.cache.Cache
oKey
- the target key; must not be null
public long getTtl()
getTtl
in interface com.bea.p13n.cache.Cache
public void setTtl(long cMillis)
setTtl
in interface com.bea.p13n.cache.Cache
cMillis
- the new default time-to-live in millisecondspublic int getMaxEntries()
getMaxEntries
in interface com.bea.p13n.cache.Cache
public void setMaxEntries(int cEntries)
setMaxEntries
in interface com.bea.p13n.cache.Cache
cEntries
- the new maximum number of entriespublic String getName()
getName
in interface com.bea.p13n.cache.Cache
public boolean isEnabled()
isEnabled
in interface com.bea.p13n.cache.Cache
public void setEnabled(boolean fEnabled)
setEnabled
in interface com.bea.p13n.cache.Cache
fEnabled
- true to enable the Cache; false to disable itpublic void resetStats()
resetStats
in interface com.bea.p13n.cache.CacheStats
public long getHitCount()
getHitCount
in interface com.bea.p13n.cache.CacheStats
public long getMissCount()
getMissCount
in interface com.bea.p13n.cache.CacheStats
public int getHitRate()
getHitRate
in interface com.bea.p13n.cache.CacheStats
public String toString()
toString
in interface com.bea.p13n.cache.Cache
protected void release()
protected Object put(Object oKey, Object oValue, long cMillis, PortalCacheProvider.CacheImpl.EntryInfo info, boolean fBlind)
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 returned
protected void flush(Object oKey)
oKey
- the optional key to flush; if null, the entire Cache
will be flushedprotected void flush(Object oKey, boolean fFlushDelegate)
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 cacheprotected boolean compactEntryInfoMap(Map map, Object oKey, PortalCacheProvider.CacheImpl.EntryInfo info)
map
- the Map that contains the EntryInfooKey
- the key used to store the EntryInfo in the given Mapinfo
- the candidate EntryInfo
protected 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 Map
protected PortalCacheProvider getCacheProvider()
protected NamedCache getNamedCache()
protected ConcurrentMap getEntryInfoMap()
protected Set getLocalClassSet()
protected LocalCache getLocalCache()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |