|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.engine.control.CompositeCache
This is the primary hub for a single cache/region. It control the flow of items through the cache. The auxiliary and memory caches are plugged in here.
Field Summary | |
private boolean |
alive
|
IElementAttributes |
attr
Region Elemental Attributes, default |
private AuxiliaryCache[] |
auxCaches
|
private int[] |
auxHitCountByIndex
Auxiliary hit counts broken down by auxiliary |
ICompositeCacheAttributes |
cacheAttr
Cache Attributes, for hub and memory auxiliary |
(package private) java.lang.String |
cacheName
|
static IElementEventQueue |
elementEventQ
EventQueue for handling element events. |
private int |
hitCountAux
Auxiliary cache hit count (number of times found in ANY auxiliary) |
private int |
hitCountRam
Memory cache hit count |
private static org.apache.commons.logging.Log |
log
|
(package private) MemoryCache |
memCache
The cache hub can only have one memory cache. |
private int |
missCountExpired
Count of misses where element was expired |
private int |
missCountNotFound
Count of misses where element was not found |
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType |
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE |
Constructor Summary | |
CompositeCache(java.lang.String cacheName,
ICompositeCacheAttributes cattr,
IElementAttributes attr)
Constructor for the Cache object |
Method Summary | |
void |
addElementEvent(IElementEventHandler hand,
IElementEvent event)
Adds an ElementEvent to be handled |
private void |
createMemoryCache(ICompositeCacheAttributes cattr)
Create the MemoryCache based on the config parameters. |
void |
dispose()
Flushes all cache items from memory to auxilliary caches and close the auxilliary caches. |
protected void |
dispose(boolean fromRemote)
invoked only by CacheManager. |
ICacheElement |
get(java.io.Serializable key)
Gets an item from the cache. |
protected ICacheElement |
get(java.io.Serializable key,
boolean localOnly)
Description of the Method |
ICompositeCacheAttributes |
getCacheAttributes()
Gets the ICompositeCacheAttributes attribute of the Cache object |
java.lang.String |
getCacheName()
Gets the cacheName attribute of the Cache object |
int |
getCacheType()
Gets the cacheType attribute of the Cache object |
IElementAttributes |
getElementAttributes()
Gets the default element attribute of the Cache object Should this return a copy? |
IElementAttributes |
getElementAttributes(java.io.Serializable key)
Gets the elementAttributes attribute of the Cache object |
java.util.Set |
getGroupKeys(java.lang.String group)
Gets the set of keys of objects currently in the group |
int |
getHitCountAux()
Number of times a requested item was found in and auxiliary cache |
int |
getHitCountRam()
Number of times a requested item was found in the memory cache |
MemoryCache |
getMemoryCache()
Access to the memory cache for instrumentation. |
int |
getMissCountExpired()
Number of times a requested element was found but was expired |
int |
getMissCountNotFound()
Number of times a requested element was not found |
int |
getSize()
Gets the size attribute of the Cache object |
int |
getStatus()
Gets the status attribute of the Cache object |
private boolean |
isExpired(ICacheElement element)
|
ICacheElement |
localGet(java.io.Serializable key)
|
boolean |
localRemove(java.io.Serializable key)
|
void |
localRemoveAll()
|
void |
localUpdate(ICacheElement ce)
Standard update method |
boolean |
remove(java.io.Serializable key)
Removes an item from the cache. |
protected boolean |
remove(java.io.Serializable key,
boolean localOnly)
fromRemote: If a remove call was made on a cache with both, then the remote should have been called. |
void |
removeAll()
Removes all cached items from the cache. |
protected void |
removeAll(boolean localOnly)
Removes all cached items. |
void |
save()
Though this put is extremely fast, this could bog the cache and should be avoided. |
void |
setAuxCaches(AuxiliaryCache[] auxCaches)
|
void |
setCacheAttributes(ICompositeCacheAttributes cattr)
Sets the ICompositeCacheAttributes attribute of the Cache object |
void |
setElementAttributes(IElementAttributes attr)
Sets the default element attribute of the Cache object |
void |
spoolToDisk(ICacheElement ce)
Writes the specified element to any disk auxilliaries Might want to rename this "overflow" incase the hub wants to do something else. |
void |
update(ICacheElement ce)
Standard update method |
protected void |
update(ICacheElement ce,
boolean localOnly)
Description of the Method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.commons.logging.Log log
public static IElementEventQueue elementEventQ
private AuxiliaryCache[] auxCaches
private boolean alive
final java.lang.String cacheName
public IElementAttributes attr
public ICompositeCacheAttributes cacheAttr
private int hitCountRam
private int hitCountAux
private int[] auxHitCountByIndex
private int missCountNotFound
private int missCountExpired
MemoryCache memCache
Constructor Detail |
public CompositeCache(java.lang.String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr)
cacheName
- The name of the regioncattr
- The cache attributeattr
- The default element attributesMethod Detail |
public void setAuxCaches(AuxiliaryCache[] auxCaches)
public void update(ICacheElement ce) throws java.io.IOException
update
in interface ICache
ce
-
java.io.IOException
public void localUpdate(ICacheElement ce) throws java.io.IOException
ce
-
java.io.IOException
protected void update(ICacheElement ce, boolean localOnly) throws java.io.IOException
ce
-
java.io.IOException
public void spoolToDisk(ICacheElement ce)
ce
- The CacheElementpublic ICacheElement get(java.io.Serializable key)
ICache
get
in interface ICache
ICache.get(java.io.Serializable)
public ICacheElement localGet(java.io.Serializable key)
ICompositeCache#localGet
protected ICacheElement get(java.io.Serializable key, boolean localOnly)
key
- localOnly
-
private boolean isExpired(ICacheElement element)
public java.util.Set getGroupKeys(java.lang.String group)
public boolean remove(java.io.Serializable key)
ICache
remove
in interface ICache
ICache.remove(java.io.Serializable)
public boolean localRemove(java.io.Serializable key)
ICompositeCache#localRemove
protected boolean remove(java.io.Serializable key, boolean localOnly)
key
- localOnly
-
public void removeAll() throws java.io.IOException
ICache
removeAll
in interface ICache
java.io.IOException
ICache.removeAll()
public void localRemoveAll() throws java.io.IOException
java.io.IOException
ICompositeCache#removeAll
protected void removeAll(boolean localOnly) throws java.io.IOException
java.io.IOException
public void dispose()
dispose
in interface ICache
protected void dispose(boolean fromRemote)
fromRemote
- public void save()
public int getSize()
getSize
in interface ICache
public int getCacheType()
getCacheType
in interface ICacheType
public int getStatus()
getStatus
in interface ICache
public java.lang.String getCacheName()
getCacheName
in interface ICache
public IElementAttributes getElementAttributes()
public void setElementAttributes(IElementAttributes attr)
public ICompositeCacheAttributes getCacheAttributes()
public void setCacheAttributes(ICompositeCacheAttributes cattr)
cattr
- The new ICompositeCacheAttributes valuepublic IElementAttributes getElementAttributes(java.io.Serializable key) throws CacheException, java.io.IOException
key
-
CacheException
java.io.IOException
public void addElementEvent(IElementEventHandler hand, IElementEvent event) throws java.io.IOException
hand
- The IElementEventHandlerevent
- The IElementEventHandler IElementEvent event
java.io.IOException
- Description of the Exceptionprivate void createMemoryCache(ICompositeCacheAttributes cattr)
cattr
- public MemoryCache getMemoryCache()
public int getHitCountRam()
public int getHitCountAux()
public int getMissCountNotFound()
public int getMissCountExpired()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |