jmcnally 2002/06/05 22:35:02
Modified: src/java/org/apache/jcs/admin/servlet JCSAdminServlet.java
src/java/org/apache/jcs/engine/control CompositeCache.java
src/java/org/apache/jcs/engine/memory/behavior
IMemoryCache.java
src/java/org/apache/jcs/engine/memory/lru
LRUMemoryCache.java
src/java/org/apache/jcs/engine/memory/mru
MRUMemoryCache.java
Added: src/java/org/apache/jcs/engine/memory
AbstractMemoryCache.java
Removed: src/java/org/apache/jcs/engine/memory
MemoryElementDescriptor.java
Log:
removed references to MemoryElementDescriptor outside of LRUMemoryCache.
moved common functionality of the LRU and MRU into a base class.
Revision Changes Path
1.3 +4 -4
jakarta-turbine-jcs/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
Index: JCSAdminServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JCSAdminServlet.java 23 May 2002 15:22:22 -0000 1.2
+++ JCSAdminServlet.java 6 Jun 2002 05:35:02 -0000 1.3
@@ -12,8 +12,8 @@
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.memory.MemoryCache;
-import org.apache.jcs.engine.memory.MemoryElementDescriptor;
import org.apache.jcs.engine.behavior.ICache;
+import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.control.CompositeCacheManager;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.velocity.Template;
@@ -47,7 +47,7 @@
* precedence.
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Taylor</a>
- * @version $Id: JCSAdminServlet.java,v 1.2 2002/05/23 15:22:22 jtaylor Exp $
+ * @version $Id: JCSAdminServlet.java,v 1.3 2002/06/06 05:35:02 jmcnally Exp $
*/
public class JCSAdminServlet extends VelocityServlet
{
@@ -199,10 +199,10 @@
while ( iter.hasNext() )
{
- MemoryElementDescriptor node = ( MemoryElementDescriptor )
+ ICacheElement ce = (ICacheElement)
( ( Map.Entry ) iter.next() ).getValue();
- out.writeObject( node.ce.getVal() );
+ out.writeObject( ce.getVal() );
}
// 4 bytes lost for the serialization header
1.3 +6 -7
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCache.java
Index: CompositeCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCache.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CompositeCache.java 23 May 2002 15:55:27 -0000 1.2
+++ CompositeCache.java 6 Jun 2002 05:35:02 -0000 1.3
@@ -73,7 +73,6 @@
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.memory.MemoryCache;
-import org.apache.jcs.engine.memory.MemoryElementDescriptor;
import org.apache.jcs.engine.memory.lru.LRUMemoryCache;
import org.apache.jcs.engine.control.event.ElementEvent;
@@ -90,7 +89,7 @@
*
*@author <a href="mailto:[EMAIL PROTECTED]">Aaron Smuts</a>
*@author <a href="mailto:[EMAIL PROTECTED]">James Taylor</a>
- *@version $Id: CompositeCache.java,v 1.2 2002/05/23 15:55:27 jtaylor Exp $
+ *@version $Id: CompositeCache.java,v 1.3 2002/06/06 05:35:02 jmcnally Exp $
*/
public class CompositeCache
implements ICache, Serializable
@@ -802,14 +801,14 @@
{
Map.Entry entry = ( Map.Entry ) itr.next();
- MemoryElementDescriptor me = (
MemoryElementDescriptor ) entry.getValue();
+ ICacheElement ce = (ICacheElement) entry.getValue();
try
{
- if ( aux.getCacheType() ==
ICacheType.LATERAL_CACHE && !me.ce.getElementAttributes().getIsLateral() )
+ if ( aux.getCacheType() ==
ICacheType.LATERAL_CACHE && !ce.getElementAttributes().getIsLateral() )
{
continue;
}
- aux.update( me.ce );
+ aux.update( ce );
}
catch ( Exception e )
{
@@ -868,9 +867,9 @@
{
Map.Entry entry = ( Map.Entry ) itr.next();
- MemoryElementDescriptor me = ( MemoryElementDescriptor
) entry.getValue();
+ ICacheElement ce = (ICacheElement) entry.getValue();
- aux.update( me.ce );
+ aux.update(ce);
}
}
}
1.1
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
Index: AbstractMemoryCache.java
===================================================================
package org.apache.jcs.engine.memory;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.CacheElement;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.jcs.engine.memory.MemoryCache;
import org.apache.jcs.engine.memory.shrinking.ShrinkerThread;
import org.apache.jcs.engine.control.group.GroupId;
import org.apache.jcs.engine.control.group.GroupAttrName;
/**
* Some common code for the LRU and MRU caches.
*
*@author <a href="mailto:[EMAIL PROTECTED]">Aaron Smuts</a>
*@author <a href="mailto:[EMAIL PROTECTED]">James Taylor</a>
*@author <a href="mailto:[EMAIL PROTECTED]">John McNally</a>
*@created May 13, 2002
*@version $Id: AbstractMemoryCache.java,v 1.1 2002/06/06 05:35:02 jmcnally Exp $
*/
public abstract class AbstractMemoryCache
implements MemoryCache, Serializable
{
private final static Log log =
LogFactory.getLog( AbstractMemoryCache.class );
protected String cacheName;
/**
* Map where items are stored by key
*/
protected Map map;
/**
* Region Elemental Attributes, used as a default.
*/
public IElementAttributes attr;
/**
* Cache Attributes
*/
public ICompositeCacheAttributes cattr;
/**
* The cache region this store is associated with
*/
protected CompositeCache cache;
// status
protected int status;
// make configurable
protected int chunkSize = 2;
/**
* The background memory shrinker
*/
private ShrinkerThread shrinker;
/**
* Constructor for the LRUMemoryCache object
*/
public AbstractMemoryCache()
{
status = CacheConstants.STATUS_ERROR;
map = new Hashtable();
}
/**
* For post reflection creation initialization
*
*@param hub
*/
public synchronized void initialize( CompositeCache hub )
{
this.cacheName = hub.getCacheName();
this.cattr = hub.getCacheAttributes();
this.cache = hub;
status = CacheConstants.STATUS_ALIVE;
if ( cattr.getUseMemoryShrinker() && shrinker == null )
{
shrinker = new ShrinkerThread( this );
shrinker.setPriority( shrinker.MIN_PRIORITY );
shrinker.start();
}
}
/**
* Removes an item from the cache
*
*@param key Identifies item to be removed
*@return Description of the Return Value
*@exception IOException Description of the Exception
*/
public abstract boolean remove( Serializable key )
throws IOException;
/**
* Get an item from the cache
*
*@param key Description of the Parameter
*@return Description of the Return Value
*@exception IOException Description of the Exception
*/
public abstract ICacheElement get( Serializable key )
throws IOException;
/**
* Get an item from the cache without effecting its order or last access
* time
*
*@param key Description of the Parameter
*@return The quiet value
*@exception IOException Description of the Exception
*/
public abstract ICacheElement getQuiet( Serializable key )
throws IOException;
/**
* Puts an item to the cache.
*
*@param ce Description of the Parameter
*@exception IOException Description of the Exception
*/
public abstract void update( ICacheElement ce )
throws IOException;
/**
* Get an Array of the keys for all elements in the memory cache
*
*@return An Object[]
*/
public abstract Object[] getKeyArray();
/**
* Removes all cached items from the cache.
*
* @exception IOException
*/
public void removeAll()
throws IOException
{
map = new HashMap();
}
/**
* Prepares for shutdown.
*
* @exception IOException
*/
public void dispose()
throws IOException
{
}
/**
* Returns the cache statistics.
*
* @return The stats value
*/
public String getStats()
{
return "";
}
/**
* Returns the current cache size.
*
* @return The size value
*/
public int getSize()
{
return this.map.size();
}
/**
* Returns the cache status.
*
* @return The status value
*/
public int getStatus()
{
return this.status;
//return this.STATUS_ALIVE;
}
/**
* Returns the cache name.
*
* @return The cacheName value
*/
public String getCacheName()
{
return this.cattr.getCacheName();
}
/**
* Puts an item to the cache.
*
* @param me
* @exception IOException
*/
public void waterfal( ICacheElement ce )
throws IOException
{
this.cache.spoolToDisk( ce );
}
/**
* Gets the iterator attribute of the LRUMemoryCache object
*
* @return The iterator value
*/
public Iterator getIterator()
{
return map.entrySet().iterator();
}
/**
* Returns the CacheAttributes.
*
* @return The CacheAttributes value
*/
public ICompositeCacheAttributes getCacheAttributes()
{
return this.cattr;
}
/**
* Sets the CacheAttributes.
*
* @param cattr The new CacheAttributes value
*/
public void setCacheAttributes( ICompositeCacheAttributes cattr )
{
this.cattr = cattr;
}
/**
* Gets the cache hub / region taht the MemoryCache is used by
*
*@return The cache value
*/
public CompositeCache getCompositeCache()
{
return this.cache;
}
}
1.8 +0 -1
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java
Index: IMemoryCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- IMemoryCache.java 23 May 2002 15:55:28 -0000 1.7
+++ IMemoryCache.java 6 Jun 2002 05:35:02 -0000 1.8
@@ -10,7 +10,6 @@
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.control.CompositeCache;
-import org.apache.jcs.engine.memory.MemoryElementDescriptor;
import org.apache.jcs.engine.control.CompositeCache;
/**
1.15 +81 -162
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java
Index: LRUMemoryCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- LRUMemoryCache.java 4 Jun 2002 23:40:30 -0000 1.14
+++ LRUMemoryCache.java 6 Jun 2002 05:35:02 -0000 1.15
@@ -16,8 +16,9 @@
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.jcs.engine.memory.MemoryCache;
-import org.apache.jcs.engine.memory.MemoryElementDescriptor;
-import org.apache.jcs.engine.memory.shrinking.ShrinkerThread;
+import org.apache.jcs.engine.memory.AbstractMemoryCache;
+import org.apache.jcs.engine.control.group.GroupId;
+import org.apache.jcs.engine.control.group.GroupAttrName;
/**
* A fast reference management system. The least recently used items move to
@@ -32,61 +33,20 @@
*
*@author <a href="mailto:[EMAIL PROTECTED]">Aaron Smuts</a>
*@author <a href="mailto:[EMAIL PROTECTED]">James Taylor</a>
+ *@author <a href="mailto:[EMAIL PROTECTED]">John McNally</a>
*@created May 13, 2002
- *@version $Id: LRUMemoryCache.java,v 1.14 2002/06/04 23:40:30 jmcnally Exp $
+ *@version $Id: LRUMemoryCache.java,v 1.15 2002/06/06 05:35:02 jmcnally Exp $
*/
-public class LRUMemoryCache implements MemoryCache, Serializable
+public class LRUMemoryCache
+ extends AbstractMemoryCache
{
private final static Log log =
LogFactory.getLog( LRUMemoryCache.class );
- String cacheName;
-
- /**
- * Map where items are stored by key
- */
- protected Map map = new Hashtable();
-
// LRU double linked list head/tail nodes
private MemoryElementDescriptor first;
private MemoryElementDescriptor last;
- private int max;
-
- /**
- * Region Elemental Attributes, used as a default.
- */
- public IElementAttributes attr;
-
- /**
- * Cache Attributes
- */
- public ICompositeCacheAttributes cattr;
-
- /**
- * The cache region this store is associated with
- */
- CompositeCache cache;
-
- // status
- private int status = CacheConstants.STATUS_ERROR;
-
- // make configurable
- private int chunkSize = 2;
-
- /**
- * The background memory shrinker
- */
- private ShrinkerThread shrinker;
-
- /**
- * Constructor for the LRUMemoryCache object
- */
- public LRUMemoryCache()
- {
- status = CacheConstants.STATUS_ERROR;
- }
-
/**
* For post reflection creation initialization
*
@@ -94,21 +54,8 @@
*/
public synchronized void initialize( CompositeCache hub )
{
- this.cacheName = hub.getCacheName();
- this.cattr = hub.getCacheAttributes();
- this.max = this.cattr.getMaxObjects();
- this.cache = hub;
-
- status = CacheConstants.STATUS_ALIVE;
-
+ super.initialize(hub);
log.info( "initialized LRUMemoryCache for " + cacheName );
-
- if ( cattr.getUseMemoryShrinker() && shrinker == null )
- {
- shrinker = new ShrinkerThread( this );
- shrinker.setPriority( shrinker.MIN_PRIORITY );
- shrinker.start();
- }
}
/**
@@ -214,6 +161,7 @@
return ce;
}
+
/**
* Get an item from the cache
*
@@ -298,6 +246,31 @@
}
}
}
+ /*
+ else if ( key instanceof GroupId )
+ {
+ // remove all keys of the same name hierarchy.
+ synchronized ( map )
+ {
+ for (Iterator itr = map.entrySet().iterator(); itr.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry) itr.next();
+ Object k = entry.getKey();
+
+ if ( k instanceof GroupAttrName
+ && ((GroupAttrName)k).groupId.equals(key) )
+ {
+ itr.remove();
+
+ removeNode( ( MemoryElementDescriptor )
+ entry.getValue() );
+
+ removed = true;
+ }
+ }
+ }
+ }
+ */
else
{
// remove single item.
@@ -314,66 +287,38 @@
return removed;
}
- /**
- * Removes all cached items from the cache.
- *
- *@exception IOException
- */
- public void removeAll()
- throws IOException
+ public class IteratorWrapper
+ implements Iterator
{
- map = new HashMap();
- }
-
- /**
- * Prepares for shutdown.
- *
- *@exception IOException
- */
- public void dispose()
- throws IOException { }
-
- /**
- * Returns the current cache size.
- *
- *@return The size value
- */
- public int getSize()
- {
- return this.map.size();
- }
-
- /**
- * Returns the cache status.
- *
- *@return The status value
- */
- public int getStatus()
- {
- return this.status;
- }
-
- /**
- * Returns the cache name.
- *
- *@return The cacheName value
- */
- public String getCacheName()
- {
- return this.cattr.getCacheName();
+ private final Iterator i;
+ private IteratorWrapper(Map m)
+ {
+ i = m.entrySet().iterator();
+ }
+ public boolean hasNext()
+ {
+ return i.hasNext();
+ }
+ public Object next()
+ {
+ return ((MemoryElementDescriptor)i.next()).ce;
+ }
+ public void remove()
+ {
+ i.remove();
+ }
}
/**
- * Gets the iterator attribute of the LRUMemoryCache object
+ * Gets the iterator attribute of the LRUMemoryCache object
*
- *@return The iterator value
+ * @return The iterator value
*/
public Iterator getIterator()
{
- return map.entrySet().iterator();
+ return new IteratorWrapper(map);
}
-
/**
* Get an Array of the keys for all elements in the memory cache
*
@@ -389,50 +334,6 @@
}
}
- /**
- * Puts an item to the cache.
- *
- *@param ce Description of the Parameter
- *@exception IOException
- */
- public void waterfal( ICacheElement ce )
- throws IOException
- {
- this.cache.spoolToDisk( ce );
- }
-
-
- /**
- * Returns the CacheAttributes.
- *
- *@return The CacheAttributes value
- */
- public ICompositeCacheAttributes getCacheAttributes()
- {
- return this.cattr;
- }
-
- /**
- * Sets the CacheAttributes.
- *
- *@param cattr The new CacheAttributes value
- */
- public void setCacheAttributes( ICompositeCacheAttributes cattr )
- {
- this.cattr = cattr;
- }
-
-
- /**
- * Gets the cache hub / region taht the MemoryCache is used by
- *
- *@return The cache value
- */
- public CompositeCache getCompositeCache()
- {
- return this.cache;
- }
-
// --------------------------- internal mehods (linked list implementation)
@@ -577,19 +478,16 @@
// ---------------------------------------------------------- debug methods
/**
- * Dump the cache map for debugging.
+ * Dump the cache map for debugging.
*/
public void dumpMap()
{
log.debug( "dumpingMap" );
- for ( Iterator itr = map.entrySet().iterator(); itr.hasNext(); )
+ for ( Iterator itr = map.entrySet().iterator(); itr.hasNext(); )
{
- //for ( Iterator itr = memCache.getIterator(); itr.hasNext();) {
Map.Entry e = ( Map.Entry ) itr.next();
- MemoryElementDescriptor me =
- ( MemoryElementDescriptor ) e.getValue();
- log.debug( "dumpMap> key=" + e.getKey()
- + ", val=" + me.ce.getVal() );
+ MemoryElementDescriptor me = ( MemoryElementDescriptor ) e.getValue();
+ log.debug( "dumpMap> key=" + e.getKey() + ", val=" + me.ce.getVal() );
}
}
@@ -604,5 +502,26 @@
log.debug( "dumpCacheEntries> key="
+ me.ce.getKey() + ", val=" + me.ce.getVal() );
}
+ }
+}
+
+/**
+ * needed for memory cache element LRU linked lisk
+ */
+class MemoryElementDescriptor implements Serializable
+{
+ /** Description of the Field */
+ public MemoryElementDescriptor prev, next;
+ /** Description of the Field */
+ public ICacheElement ce;
+
+ /**
+ * Constructor for the MemoryElementDescriptor object
+ *
+ * @param ce
+ */
+ public MemoryElementDescriptor( ICacheElement ce )
+ {
+ this.ce = ce;
}
}
1.9 +14 -196
jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/mru/MRUMemoryCache.java
Index: MRUMemoryCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/memory/mru/MRUMemoryCache.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MRUMemoryCache.java 23 May 2002 15:55:28 -0000 1.8
+++ MRUMemoryCache.java 6 Jun 2002 05:35:02 -0000 1.9
@@ -16,8 +16,7 @@
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.jcs.engine.memory.MemoryCache;
-import org.apache.jcs.engine.memory.MemoryElementDescriptor;
-import org.apache.jcs.engine.memory.shrinking.ShrinkerThread;
+import org.apache.jcs.engine.memory.AbstractMemoryCache;
/**
* A SLOW AS HELL reference management system. The most recently used items move
@@ -26,21 +25,15 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Aaron Smuts</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Taylor</a>
- * @version $Id: MRUMemoryCache.java,v 1.8 2002/05/23 15:55:28 jtaylor Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">John McNally</a>
+ * @version $Id: MRUMemoryCache.java,v 1.9 2002/06/06 05:35:02 jmcnally Exp $
*/
public class MRUMemoryCache
- implements MemoryCache, Serializable
+ extends AbstractMemoryCache
{
private final static Log log =
LogFactory.getLog( MRUMemoryCache.class );
- String cacheName;
-
- /**
- * Storage of cache items.
- */
- protected HashMap map = new HashMap();
-
/**
* Description of the Field
*/
@@ -51,61 +44,18 @@
*/
protected LinkedList mrulist = new LinkedList();
- // Region Elemental Attributes
- /**
- * Description of the Field
- */
- public IElementAttributes attr;
-
- // Cache Attributes
- /**
- * Description of the Field
- */
- public ICompositeCacheAttributes cattr;
-
- // The HUB
- CompositeCache cache;
-
- // status
- private int status;
-
- // make configurable
- private int chunkSize = 2;
-
/**
- * The background memory shrinker
- */
- private ShrinkerThread shrinker;
-
- /**
- * Constructor for the LRUMemoryCache object
- */
- public MRUMemoryCache()
- {
- status = CacheConstants.STATUS_ERROR;
- }
-
- /**
- * For post reflection creation initialization
+ * For post reflection creation initialization
*
- * @param cache
+ *@param hub
*/
- public synchronized void initialize( CompositeCache cache )
+ public synchronized void initialize( CompositeCache hub )
{
- this.cacheName = cache.getCacheName();
- this.cattr = cache.getCacheAttributes();
- this.cache = cache;
-
- status = CacheConstants.STATUS_ALIVE;
-
- if ( cattr.getUseMemoryShrinker() && shrinker == null )
- {
- shrinker = new ShrinkerThread( this );
- shrinker.setPriority( shrinker.MIN_PRIORITY );
- shrinker.start();
- }
+ super.initialize(hub);
+ log.info( "initialized MRUMemoryCache for " + cacheName );
}
+
/**
* Puts an item to the cache.
*
@@ -115,7 +65,6 @@
public void update( ICacheElement ce )
throws IOException
{
-
Serializable key = ce.getKey();
ce.getElementAttributes().setLastAccessTimeNow();
@@ -192,13 +141,9 @@
ex.printStackTrace();
throw new IllegalStateException( ex.getMessage() );
}
-
}
-
}
-
-
/**
* Get an item from the cache without affecting its last access
* time or position.
@@ -210,7 +155,6 @@
public ICacheElement getQuiet( Serializable key )
throws IOException
{
-
ICacheElement ce = null;
try
@@ -237,10 +181,8 @@
}
return ce;
-
}
-
/**
* Description of the Method
*
@@ -251,7 +193,6 @@
public ICacheElement get( Serializable key )
throws IOException
{
-
ICacheElement ce = null;
boolean found = false;
@@ -340,7 +281,6 @@
public boolean remove( Serializable key )
throws IOException
{
-
if ( log.isDebugEnabled() )
{
log.debug( "remove> key=" + key );
@@ -391,97 +331,6 @@
}
/**
- * Removes all cached items from the cache.
- *
- * @exception IOException
- */
- public void removeAll()
- throws IOException
- {
- map = new HashMap();
- }
-
- /**
- * Prepares for shutdown.
- *
- * @exception IOException
- */
- public void dispose()
- throws IOException
- {
- }
-
- /**
- * Returns the cache statistics.
- *
- * @return The stats value
- */
- public String getStats()
- {
- return "";
- }
-
- /**
- * Returns the current cache size.
- *
- * @return The size value
- */
- public int getSize()
- {
- return this.map.size();
- }
-
- /**
- * Returns the cache status.
- *
- * @return The status value
- */
- public int getStatus()
- {
- return this.status;
- //return this.STATUS_ALIVE;
- }
-
- /**
- * Returns the cache name.
- *
- * @return The cacheName value
- */
- public String getCacheName()
- {
- return this.cattr.getCacheName();
- }
-
- /**
- * Puts an item to the cache.
- *
- * @param me
- * @exception IOException
- */
-// public void waterfal( MemoryElementDescriptor me )
-// throws IOException
-// {
-// this.cache.spoolToDisk( me.ce );
-// }
- public void waterfal( ICacheElement ce )
- throws IOException
- {
- this.cache.spoolToDisk( ce );
- }
-
- /**
- * Gets the iterator attribute of the LRUMemoryCache object
- *
- * @return The iterator value
- */
- public Iterator getIterator()
- {
- //return Collections.enumeration(map.entrySet());
- return map.entrySet().iterator();
- }
-
-
- /**
* Get an Array of the keys for all elements in the memory cache
*
* @return Object[]
@@ -496,37 +345,6 @@
}
/**
- * Returns the CacheAttributes.
- *
- * @return The CacheAttributes value
- */
- public ICompositeCacheAttributes getCacheAttributes()
- {
- return this.cattr;
- }
-
- /**
- * Sets the CacheAttributes.
- *
- * @param cattr The new CacheAttributes value
- */
- public void setCacheAttributes( ICompositeCacheAttributes cattr )
- {
- this.cattr = cattr;
- }
-
- /**
- * Gets the cache hub / region taht the MemoryCache is used by
- *
- *@return The cache value
- */
- public CompositeCache getCompositeCache()
- {
- return this.cache;
- }
-
-
- /**
* Dump the cache map for debugging.
*/
public void dumpMap()
@@ -536,10 +354,10 @@
{
//for ( Iterator itr = memCache.getIterator(); itr.hasNext();) {
Map.Entry e = ( Map.Entry ) itr.next();
- MemoryElementDescriptor me = ( MemoryElementDescriptor ) e.getValue();
- log.debug( "dumpMap> key=" + e.getKey() + ", val=" + me.ce.getVal() );
- }
- }
+ ICacheElement ce = ( ICacheElement ) e.getValue();
+ log.debug( "dumpMap> key=" + e.getKey() + ", val=" + ce.getVal() );
+ }
+ }
/**
* Dump the cache entries from first to list for debugging.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>