Author: asmuts
Date: Mon Feb 20 12:04:02 2006
New Revision: 379217
URL: http://svn.apache.org/viewcvs?rev=379217&view=rev
Log:
added new index page, event handling doc, additional disk cache config docs,
and several new faq entries.
made a few small changes suggested by pmd.
Added:
jakarta/jcs/trunk/xdocs/ElementEventHandling.xml
jakarta/jcs/trunk/xdocs/JCSShortDescription.xml
- copied, changed from r377776, jakarta/jcs/trunk/xdocs/index.xml
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
jakarta/jcs/trunk/xdocs/ElementAttributes.xml
jakarta/jcs/trunk/xdocs/faq.fml
jakarta/jcs/trunk/xdocs/index.xml
jakarta/jcs/trunk/xdocs/navigation.xml
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/access/CacheAccess.java Mon Feb
20 12:04:02 2006
@@ -263,7 +263,8 @@
throws CacheException
{
// Call put with a copy of the contained caches default attributes.
- put( name, obj, this.cacheControl.getElementAttributes().copy() );
+ // the attributes are copied by the cacheControl
+ put( name, obj, this.cacheControl.getElementAttributes() );
}
/*
@@ -478,7 +479,8 @@
}
/**
- * Retrieves the default element attributes used by this region.
+ * Retrieves A COPY OF the default element attributes used by this region.
+ * This does not provide a reference to the element attributes.
* <p>
* Each time an element is added to the cache without element attributes,
* the default element attributes are cloned.
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java Mon Feb
20 12:04:02 2006
@@ -26,6 +26,8 @@
import java.util.LinkedList;
import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.CompositeCache;
@@ -43,6 +45,8 @@
public class JCSAdminBean
{
+ private static final Log log = LogFactory.getLog( JCSAdminBean.class );
+
private CompositeCacheManager cacheHub =
CompositeCacheManager.getInstance();
/**
@@ -160,19 +164,19 @@
ObjectOutputStream out = new ObjectOutputStream( counter );
// non serializable objects will cause problems here
- // stop at the first non serializable exception.
+ // stop at the first non serializable exception.
try
{
while ( iter.hasNext() )
{
ICacheElement ce = (ICacheElement) ( (Map.Entry) iter.next()
).getValue();
-
+
out.writeObject( ce.getVal() );
}
}
catch ( Exception e )
{
- // log later
+ log.info( "Problem getting byte count. Likley cause is a non
serilizable object." + e.getMessage() );
}
// 4 bytes lost for the serialization header
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
Mon Feb 20 12:04:02 2006
@@ -112,11 +112,7 @@
}
else if ( action.equals( CLEAR_REGION_ACTION ) )
{
- if ( cacheName == null )
- {
- // Not Allowed
- }
- else
+ if ( cacheName != null )
{
admin.clearRegion( cacheName );
}
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
Mon Feb 20 12:04:02 2006
@@ -27,7 +27,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.jcs.auxiliary.AuxiliaryCache;
import org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
import org.apache.jcs.engine.CacheConstants;
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java
Mon Feb 20 12:04:02 2006
@@ -258,7 +258,6 @@
throws IOException
{
raf.close();
- return;
}
/**
@@ -293,7 +292,6 @@
throw ex;
}
raf = new RandomAccessFile( filepath, "rw" );
- return;
}
/**
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
Mon Feb 20 12:04:02 2006
@@ -317,7 +317,10 @@
}
finally
{
- // noopt
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Finished saving keys." );
+ }
}
}
catch ( Exception e )
@@ -431,13 +434,17 @@
{
// do nothing, this means it has gone back to memory mid
// serialization
+ if ( log.isInfoEnabled() )
+ {
+ // this shouldn't be possible
+ log.info( "Caught ConcurrentModificationException." + cme );
+ }
}
catch ( Exception e )
{
log.error( "Failure updating element, cacheName: " + cacheName +
", key: " + ce.getKey() + " old: " + old,
e );
}
- return;
}
/**
@@ -683,7 +690,7 @@
}
/**
- * Remove all the items fromt he disk cache by reseting everything.
+ * Remove all the items from the disk cache by reseting everything.
*/
public void doRemoveAll()
{
@@ -693,12 +700,8 @@
}
catch ( Exception e )
{
- log.error( e );
+ log.error( "Problem removing all.", e );
reset();
- }
- finally
- {
- // swallow
}
}
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java
(original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ElementAttributes.java Mon
Feb 20 12:04:02 2006
@@ -85,7 +85,7 @@
public long maxIdleTimeSeconds = -1;
/**
- * The byte size of teh field. Must be manually set.
+ * The byte size of the field. Must be manually set.
*/
public int size = 0;
@@ -446,7 +446,7 @@
* caller's list will not be reflected.
*
* @param eventHandlers
- * value
+ * List of IElementEventHandler objects
*/
public void addElementEventHandlers( ArrayList eventHandlers )
{
@@ -465,7 +465,7 @@
* Gets the elementEventHandlers. Returns null if none exist. Makes
checking
* easy.
*
- * @return The elementEventHandlers value
+ * @return The elementEventHandlers List of IElementEventHandler objects
*/
public ArrayList getElementEventHandlers()
{
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
Mon Feb 20 12:04:02 2006
@@ -19,10 +19,10 @@
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.HashSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,7 +36,13 @@
import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.IElementAttributes;
-
+import org.apache.jcs.engine.control.event.ElementEvent;
+import org.apache.jcs.engine.control.event.ElementEventQueue;
+import org.apache.jcs.engine.control.event.behavior.IElementEvent;
+import org.apache.jcs.engine.control.event.behavior.IElementEventConstants;
+import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
+import org.apache.jcs.engine.control.event.behavior.IElementEventQueue;
+import org.apache.jcs.engine.control.group.GroupId;
import org.apache.jcs.engine.memory.MemoryCache;
import org.apache.jcs.engine.memory.lru.LRUMemoryCache;
import org.apache.jcs.engine.stats.CacheStats;
@@ -46,14 +52,6 @@
import org.apache.jcs.engine.stats.behavior.IStatElement;
import org.apache.jcs.engine.stats.behavior.IStats;
-import org.apache.jcs.engine.control.event.ElementEvent;
-import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
-import org.apache.jcs.engine.control.event.behavior.IElementEvent;
-import org.apache.jcs.engine.control.event.behavior.IElementEventConstants;
-import org.apache.jcs.engine.control.event.behavior.IElementEventQueue;
-import org.apache.jcs.engine.control.event.ElementEventQueue;
-import org.apache.jcs.engine.control.group.GroupId;
-
/**
* This is the primary hub for a single cache/region. It controls the flow of
* items through the cache. The auxiliary and memory caches are plugged in
here.
@@ -86,12 +84,12 @@
/**
* Region Elemental Attributes, default
*/
- public IElementAttributes attr;
+ private IElementAttributes attr;
/**
* Cache Attributes, for hub and memory auxiliary
*/
- public ICompositeCacheAttributes cacheAttr;
+ private ICompositeCacheAttributes cacheAttr;
// Statistics
private int updateCount;
@@ -205,8 +203,9 @@
// not thread safe, but just for debugging and testing.
updateCount++;
-
- if ( cacheElement.getKey() instanceof String &&
cacheElement.getKey().toString().endsWith(
CacheConstants.NAME_COMPONENT_DELIMITER ) )
+
+ if ( cacheElement.getKey() instanceof String
+ && cacheElement.getKey().toString().endsWith(
CacheConstants.NAME_COMPONENT_DELIMITER ) )
{
throw new IllegalArgumentException( "key must not end with " +
CacheConstants.NAME_COMPONENT_DELIMITER
+ " for a put operation" );
@@ -259,7 +258,8 @@
{
if ( log.isDebugEnabled() )
{
- log.debug( "ce.getElementAttributes().getIsRemote() = " +
cacheElement.getElementAttributes().getIsRemote() );
+ log.debug( "ce.getElementAttributes().getIsRemote() = "
+ + cacheElement.getElementAttributes().getIsRemote() );
}
if ( cacheElement.getElementAttributes().getIsRemote() &&
!localOnly )
@@ -329,7 +329,7 @@
// if the item is not spoolable, return
if ( !ce.getElementAttributes().getIsSpool() )
{
- //TODO define an event for this.
+ // there is an event defined for this.
handleElementEvent( ce,
IElementEventConstants.ELEMENT_EVENT_SPOOLED_NOT_ALLOWED );
return;
}
@@ -518,10 +518,11 @@
missCountExpired++;
- // this will tell the remotes to remove the
item based on this
- // local's expiration policy.
- // This seems wrong.
- //TODO We should call localRemove
+ // this will tell the remotes to remove the
item
+ // based on this
+ // local's expiration policy.
+ // This seems wrong.
+ // TODO We should call localRemove
remove( key );
element = null;
@@ -617,7 +618,8 @@
long lastAccessTime = attributes.getLastAccessTime();
// Remove if maxIdleTime exceeded
- // If you have a 0 size memory cache, then the last access
will not get updated.
+ // If you have a 0 size memory cache, then the last access will
+ // not get updated.
// you will need to set the idle time to -1.
if ( ( idleTime != -1 ) && ( now - lastAccessTime ) > (
idleTime * 1000 ) )
@@ -662,7 +664,7 @@
}
catch ( IOException e )
{
- //ignore
+ // ignore
}
}
}
@@ -713,7 +715,7 @@
{
// not thread safe, but just for debugging and testing.
removeCount++;
-
+
boolean removed = false;
try
@@ -779,7 +781,7 @@
}
/**
- * Will not pass the remove message remotely.
+ * Will not pass the remove message remotely.
*
* @throws IOException
*/
@@ -792,8 +794,9 @@
/**
* Removes all cached items.
*
- * @param localOnly must pass in false to get remote and lateral aux's
updated. This prevents
- * looping.
+ * @param localOnly
+ * must pass in false to get remote and lateral aux's updated.
+ * This prevents looping.
* @throws IOException
*/
protected synchronized void removeAll( boolean localOnly )
@@ -877,9 +880,9 @@
ICache aux = auxCaches[i];
// Skip this auxilliary if:
- // - The auxilliary is null
- // - The auxilliary is not alive
- // - The auxilliary is remote and the invocation was remote
+ // - The auxilliary is null
+ // - The auxilliary is not alive
+ // - The auxilliary is remote and the invocation was remote
if ( aux == null || aux.getStatus() !=
CacheConstants.STATUS_ALIVE || fromRemote
&& aux.getCacheType() == REMOTE_CACHE )
@@ -891,13 +894,13 @@
// have 'getUseLateral' set, all the elements currently in
// memory are written to the lateral before disposing
- //TODO make sure disk gets a change to finish
+ // TODO make sure disk gets a change to finish
if ( aux.getCacheType() != ICacheType.LATERAL_CACHE ||
this.cacheAttr.getUseLateral() )
{
Iterator itr = memCache.getIterator();
log.info( "In dispose, " + this.cacheName + "
memCache.size = " + memCache.getSize() );
-
+
int cnt = 0;
while ( itr.hasNext() )
{
@@ -923,7 +926,7 @@
log.info( "In dispose, " + this.cacheName + " put " + cnt
+ " into auxiliary " + aux );
}
-
+
// Dispose of the auxiliary
aux.dispose();
@@ -944,15 +947,19 @@
{
log.error( "Failure disposing of memCache", ex );
}
-
+
log.warn( "Called close for " + cacheName );
}
/**
+ * Calling save cause the entire contents of the memory cache to be flushed
+ * to all auxiliaries.
+ *
* Though this put is extremely fast, this could bog the cache and should
be
* avoided. The dispose method should call a version of this. Good for
* testing.
+ *
*/
public void save()
{
@@ -1098,13 +1105,17 @@
/**
* Gets the default element attribute of the Cache object
*
- * Should this return a copy?
+ * This returna a copy. It does not return a reference to the attributes.
*
* @return The attributes value
*/
public IElementAttributes getElementAttributes()
{
- return attr;
+ if ( attr != null )
+ {
+ return attr.copy();
+ }
+ return null;
}
/**
@@ -1247,8 +1258,9 @@
* If there are event handlers for the item, then create an event and queue
* it up.
* <p>
- * This does not call handle directly; instead the handler and the event
are put into a queue.
- * This prevents the event handling from blocking normal cache operations.
+ * This does not call handle directly; instead the handler and the event
are
+ * put into a queue. This prevents the event handling from blocking normal
+ * cache operations.
*
* @param ce
* @param eventType
@@ -1302,7 +1314,8 @@
}
/**
- * @param updateCount The updateCount to set.
+ * @param updateCount
+ * The updateCount to set.
*/
public void setUpdateCount( int updateCount )
{
@@ -1318,7 +1331,8 @@
}
/**
- * @param removeCount The removeCount to set.
+ * @param removeCount
+ * The removeCount to set.
*/
public void setRemoveCount( int removeCount )
{
@@ -1332,13 +1346,14 @@
{
return removeCount;
}
-
+
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
public String toString()
- {
- return getStats();
- }
+ {
+ return getStats();
+ }
}
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java
(original)
+++
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java
Mon Feb 20 12:04:02 2006
@@ -19,7 +19,7 @@
import java.io.Serializable;
/**
- * Defines how an element event object should behave
+ * Defines how an element event object should behave.
*
*/
public interface IElementEvent
Modified:
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
(original)
+++
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
Mon Feb 20 12:04:02 2006
@@ -21,6 +21,7 @@
import junit.framework.TestSuite;
import org.apache.jcs.JCS;
+import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.control.event.behavior.IElementEvent;
import org.apache.jcs.engine.control.event.behavior.IElementEventConstants;
import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
@@ -95,7 +96,9 @@
JCS jcs = JCS.getInstance( "WithDisk" );
// this should add the event handler to all items as they are created.
- jcs.getDefaultElementAttributes().addElementEventHandler( meh );
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.setDefaultElementAttributes( attributes );
// put them in
for ( int i = 0; i <= items; i++ )
@@ -120,11 +123,14 @@
public void testSpoolNoDiskEvent()
throws Exception
{
+ JCS jcs = JCS.getInstance( "NoDisk" );
+
MyEventHandler meh = new MyEventHandler();
- JCS jcs = JCS.getInstance( "NoDisk" );
// this should add the event handler to all items as they are created.
- jcs.getDefaultElementAttributes().addElementEventHandler( meh );
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.setDefaultElementAttributes( attributes );
// put them in
for ( int i = 0; i <= items; i++ )
@@ -153,7 +159,9 @@
JCS jcs = JCS.getInstance( "DiskButNotAllowed" );
// this should add the event handler to all items as they are created.
- jcs.getDefaultElementAttributes().addElementEventHandler( meh );
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.setDefaultElementAttributes( attributes );
// put them in
for ( int i = 0; i <= items; i++ )
@@ -170,6 +178,39 @@
}
+
+ /**
+ * Test the ELEMENT_EVENT_SPOOLED_NOT_ALLOWED event.
+ *
+ * @throws Exception
+ */
+ public void testSpoolNotAllowedEventOnItem()
+ throws Exception
+ {
+ MyEventHandler meh = new MyEventHandler();
+
+ JCS jcs = JCS.getInstance( "DiskButNotAllowed" );
+ // this should add the event handler to all items as they are created.
+ //IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ //attributes.addElementEventHandler( meh );
+ //jcs.setDefaultElementAttributes( attributes );
+
+ // put them in
+ for ( int i = 0; i <= items; i++ )
+ {
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.put( i + ":key", "data" + i, attributes );
+ }
+
+ // wait a bit for it to finish
+ Thread.sleep( items / 20 );
+
+ // test to see if the count is right
+ assertTrue( "The number of ELEMENT_EVENT_SPOOLED_NOT_ALLOWED events ["
+ meh.getSpoolNotAllowedCount()
+ + "] does not equal the number expected.",
meh.getSpoolNotAllowedCount() >= items );
+
+ }
/**
* Simple event counter used to verify test results.
*
Modified:
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
(original)
+++
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
Mon Feb 20 12:04:02 2006
@@ -124,7 +124,7 @@
for ( int i = 0; i < items; i++ )
{
ICacheElement ice = new CacheElement( cache.getCacheName(), i +
":key", region + " data " + i );
- ice.setElementAttributes( cache.getElementAttributes().copy() );
+ ice.setElementAttributes( cache.getElementAttributes() );
lru.update( ice );
}
Modified:
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
---
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
(original)
+++
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
Mon Feb 20 12:04:02 2006
@@ -227,7 +227,7 @@
for ( int i = 0; i < items; i++ )
{
ICacheElement ice = new CacheElement( cache.getCacheName(), i +
":key", cache.getCacheName() + " data " + i );
- ice.setElementAttributes( cache.getElementAttributes().copy() );
+ ice.setElementAttributes( cache.getElementAttributes() );
mru.update( ice );
}
Modified: jakarta/jcs/trunk/xdocs/ElementAttributes.xml
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/ElementAttributes.xml?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/ElementAttributes.xml (original)
+++ jakarta/jcs/trunk/xdocs/ElementAttributes.xml Mon Feb 20 12:04:02 2006
@@ -1,31 +1,32 @@
<?xml version="1.0"?>
<document>
- <properties>
- <title>Element Attribute Configuration</title>
- <author email="ASmuts@xxxxxxxxxx">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Element Attribute Configuration">
- <p>
- The following document describes the various
- configuration options available for cache elements.
- Each element put into the cache can be configured
- independently. You can define element behavior in
- three ways: as a default setting, as a region setting,
- or at the element level.
- </p>
-
- <subsection name="Setting the defaults">
- <p>
- The configuration below can be put in the cache.ccf
- configuration file. It establishes the default behavior
- for all regions. A region can override these defaults and
- an individual element can overide these defaults and
- the region settings.
- </p>
- <source><![CDATA[
+ <properties>
+ <title>Element Attribute Configuration</title>
+ <author email="ASmuts@xxxxxxxxxx">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Element Attribute Configuration">
+ <p>
+ The following document describes the various
+ configuration options available for cache
elements. Each
+ element put into the cache can be configured
+ independently. You can define element behavior
in three
+ ways: as a default setting, as a region
setting, or at
+ the element level.
+ </p>
+
+ <subsection name="Setting the defaults">
+ <p>
+ The configuration below can be put in
the cache.ccf
+ configuration file. It establishes the
default
+ behavior for all regions. A region can
override
+ these defaults and an individual
element can overide
+ these defaults and the region settings.
+ </p>
+ <source>
+ <![CDATA[
# DEFAULT CACHE REGION
jcs.default=DC
@@ -44,56 +45,122 @@
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true
- ]]></source>
- <p>
- The default and region configuration settings have three
- components. They define what auxiliaries are available,
- how the cache should control the memory, and how the elements
- should behave. This configuration tells all regions to use
- an auxiliary called DC by default. It also establishes
- several settings for memory management (see <a
- href="BasicJCSConfiguration.html">Basic JCS Configuration</a>
- for more information on the cacheattribute settings). In
addition,
- by default all regions will take these element configuration
- settings.
- </p>
- <p>
- These settings specify that elements are not eternal, i.e. they
- can expire. By default elements are considered eternal.
- </p>
- <p>
- You can define the maximum life of an item by setting the
- <code>MaxLifeSeconds</code> parameter. If an item has been in
- the cache for longer than the set number of seconds it will
- not be retrieved on a get request. If you use the memory shrinker
- the item will be actively removed from memory. Currently there is
- no background disk shrinker, but the disk cache does allow for
- a maximum number of keys (see <a
- href="IndexedDiskAuxCache.html">Indexed Disk Cache</a>
- for more information on the disk cache settings).
- </p>
- <p>
- You can define the maximum time an item can live without being
accessed
- by setting the <code>IdleTime</code> parameter. This is different
than
- the <code>MaxMemoryIdleTimeSeconds</code> parameter, which just
specifies
- how long an object can be in memory before it is subjected to
removal or
- being spooled to a disk cache if it is available. Note: the
<code>IdleTime</code>
- parameter may not function properly for items retrieved from disk,
- if you have a memory size of 0.
- </p>
- </subsection>
- <p>
- <code>IsSpool</code> determines whether or not the element can go
to disk,
- if a disk cache is configured for the region.
- </p>
- <p>
- <code>IsRemote</code> determines whether or not the element can be
sent
- to a remote server, if one is configured for the region.
- </p>
- <p>
- <code>IsLateral</code> determines whether or not the element can be
laterally
- distributed, if a lateral auxiliary is configured for the region.
- </p>
- </section>
- </body>
+ ]]>
+ </source>
+ <p>
+ The default and region configuration
settings have
+ three components. They define what
auxiliaries are
+ available, how the cache should control
the memory,
+ and how the elements should behave. This
+ configuration tells all regions to use
an auxiliary
+ called DC by default. It also
establishes several
+ settings for memory management (see
+ <a href="BasicJCSConfiguration.html">
+ Basic JCS Configuration
+ </a>
+ for more information on the
cacheattribute
+ settings). In addition, by default all
regions will
+ take these element configuration
settings.
+ </p>
+ <p>
+ These settings specify that elements
are not
+ eternal, i.e. they can expire. By
default elements
+ are considered eternal.
+ </p>
+ <p>
+ You can define the maximum life of an
item by
+ setting the
+ <code>MaxLifeSeconds</code>
+ parameter. If an item has been in the
cache for
+ longer than the set number of seconds
it will not be
+ retrieved on a get request. If you use
the memory
+ shrinker the item will be actively
removed from
+ memory. Currently there is no
background disk
+ shrinker, but the disk cache does allow
for a
+ maximum number of keys (see
+ <a href="IndexedDiskAuxCache.html">
+ Indexed Disk Cache
+ </a>
+ for more information on the disk cache
settings).
+ </p>
+ <p>
+ You can define the maximum time an item
can live
+ without being accessed by setting the
+ <code>IdleTime</code>
+ parameter. This is different than the
+ <code>MaxMemoryIdleTimeSeconds</code>
+ parameter, which just specifies how
long an object
+ can be in memory before it is subjected
to removal
+ or being spooled to a disk cache if it
is available.
+ Note: the
+ <code>IdleTime</code>
+ parameter may not function properly for
items
+ retrieved from disk, if you have a
memory size of 0.
+ </p>
+ </subsection>
+
+ <p>
+ <code>IsSpool</code>
+ determines whether or not the element can go to
disk, if
+ a disk cache is configured for the region.
+ </p>
+ <p>
+ <code>IsRemote</code>
+ determines whether or not the element can be
sent to a
+ remote server, if one is configured for the
region.
+ </p>
+ <p>
+ <code>IsLateral</code>
+ determines whether or not the element can be
laterally
+ distributed, if a lateral auxiliary is
configured for
+ the region.
+ </p>
+
+
+ <subsection name="Programmatic Configuration">
+ <p>
+ Every element put into the cache has
its own set of
+ attributes. By default elements are
given a copy of
+ the default element attributes
associated with a
+ region. You can also specify the
attributes to use
+ for an element when you put it in the
cache.
+ </p>
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+
+ // set some special value
+ attributes.setIsEternal( true );
+ jcs.put( "key", "data", attributes );
+ ]]>
+ </source>
+
+ <p>
+ You can also programmatically modify
the default
+ element attributes.
+ </p>
+
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+
+ // set some special value
+ attributes.setIsEternal( true );
+ jcs.setDefaultElementAttributes( attributes );
+ ]]>
+ </source>
+ </subsection>
+
+ </section>
+ </body>
</document>
Added: jakarta/jcs/trunk/xdocs/ElementEventHandling.xml
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/ElementEventHandling.xml?rev=379217&view=auto
==============================================================================
--- jakarta/jcs/trunk/xdocs/ElementEventHandling.xml (added)
+++ jakarta/jcs/trunk/xdocs/ElementEventHandling.xml Mon Feb 20 12:04:02 2006
@@ -0,0 +1,167 @@
+<?xml version="1.0"?>
+
+<document>
+ <properties>
+ <title>Element Event Handling</title>
+ <author email="ASmuts@xxxxxxxxxx">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Element Event Handling">
+ <p>
+ JCS allows you to attach event handlers to
elements in
+ the local memory cache.
+ </p>
+ <p>
+ There are several events that you can listen
for. All of
+ the events are local memory related events.
Element
+ event handlers are not transmitted to other
caches via
+ lateral or remote auxiliaries, nor are they
spooled to
+ disk.
+ </p>
+ <p>
+ You can register multiple handlers for a single
item.
+ Although the handlers are associated with
particular
+ items, you can also setup default handlers for
any
+ region. Each item put into the region, that
will take
+ the default element attributes, will be
assigned the
+ event default event handlers.
+ </p>
+ <p>
+ The various events that you can handle have all
been
+ assigned integer codes. The codes are defined
in the
+
org.apache.jcs.engine.control.event.behavior.IElementEventConstants
+ interface. The events are named descriptively
and
+ include:
+ </p>
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND</td>
+ <td>
+ The element exceeded its max
life. This was
+ detected in a background
cleanup.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST</td>
+ <td>
+ The element exceeded its max
life. This was
+ detected on request.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND</td>
+ <td>
+ The element exceeded its max
idle. This was
+ detected in a background
cleanup.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST</td>
+ <td>
+ The element exceeded its max
idle time. This was
+ detected on request.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE</td>
+ <td>
+ The element was pushed out of
the memory store,
+ there is a disk store available
for the region,
+ and the element is marked as
spoolable.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE</td>
+ <td>
+ The element was pushed out of
the memory store,
+ and there is not a disk store
available for the
+ region.
+ </td>
+ </tr>
+ <tr>
+
<td>ELEMENT_EVENT_SPOOLED_NOT_ALLOWED</td>
+ <td>
+ The element was pushed out of
the memory store,
+ there is a disk store available
for the region,
+ but the element is marked as
not spoolable.
+ </td>
+ </tr>
+ </table>
+ <p>
+ To create an event handler you must implement
the
+
org.apache.jcs.engine.control.event.behavior.IElementEventHandler
+ interface. This interface contains only one
method:
+ </p>
+ <source>
+ <![CDATA[
+ public void handleElementEvent( IElementEvent event );
+ ]]>
+ </source>
+ <p>
+ The IElementEvent object contains both the
event code
+ and the source. The source is the element for
which the
+ event occurred. The code is the type of event.
If you
+ have an event handler registered, it will be
called
+ whenever any event occurs. It is up to the
handler to
+ decide what it would like to do for the
particular
+ event. Since there are not that many events,
this does
+ not create too much activity. Also, the event
handling
+ is done asynchronously. Events are added to an
event
+ queue and processed by background threads.
+ </p>
+ <p>
+ Once you have an IElementEventHandler
implementation,
+ you can attach it to an element via the Element
+ Attributes. You can either add it to the element
+ attributes when you put an item into the cache,
add it
+ to the attributes of an item that exist in the
cache
+ (which just results in a re-put), or add the
event
+ handler to the default element attributes for a
region.
+ If you add it to the default attributes, then
all
+ elements subsequently added to the region that
do not
+ define their own element attributes will be
assigned the
+ default event handlers.
+ </p>
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ MyEventHandler meh = new MyEventHandler();
+
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.put( "key", "data", attributes );
+ ]]>
+ </source>
+ <p>
+ Here is how to setup an event handler as a
default
+ setting for a region:
+ </p>
+ <source>
+ <![CDATA[
+ JCS jcs = JCS.getInstance( "myregion" );
+
+ . . .
+
+ MyEventHandler meh = new MyEventHandler();
+
+ // this should add the event handler to all items as
+ //they are created.
+ // jcs.getDefaultElementAttributes returns a copy not a reference
+ IElementAttributes attributes = jcs.getDefaultElementAttributes();
+ attributes.addElementEventHandler( meh );
+ jcs.setDefaultElementAttributes( attributes );
+ ]]>
+ </source>
+
+ </section>
+ </body>
+</document>
\ No newline at end of file
Copied: jakarta/jcs/trunk/xdocs/JCSShortDescription.xml (from r377776,
jakarta/jcs/trunk/xdocs/index.xml)
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/JCSShortDescription.xml?p2=jakarta/jcs/trunk/xdocs/JCSShortDescription.xml&p1=jakarta/jcs/trunk/xdocs/index.xml&r1=377776&r2=379217&rev=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/index.xml (original)
+++ jakarta/jcs/trunk/xdocs/JCSShortDescription.xml Mon Feb 20 12:04:02 2006
@@ -30,23 +30,23 @@
<ul>
<li>Memory management</li>
<li>Disk overflow (and defragmentation)</li>
+ <li>Thread pool controls</li>
<li>Element grouping</li>
<li>Quick nested categorical removal</li>
- <li>Data expiration</li>
+ <li>Data expiration (idle time and max life)</li>
<li>Extensible framework</li>
<li>Fully configurable runtime parameters</li>
+ <li>Region data separation and configuration</li>
+ <li>Fine grained element configuration options</li>
<li>Remote synchronization</li>
<li>Remote store recovery</li>
<li>Non-blocking "zombie" (balking facade) pattern</li>
- <li>Optional lateral distribution of elements via HTTP, TCP, or
+ <li>Lateral distribution of elements via HTTP, TCP, or
UDP</li>
+ <li>UDP Discovery of other caches</li>
+ <li>Element event handling</li>
<li>Remote server chaining (or clustering) and failover</li>
</ul>
- <p>
- These features provide a framework with no point of failure,
- allowing for full session failover including session data across
- multiple servers.
- </p>
</section>
</body>
</document>
Modified: jakarta/jcs/trunk/xdocs/faq.fml
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/faq.fml?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/faq.fml (original)
+++ jakarta/jcs/trunk/xdocs/faq.fml Mon Feb 20 12:04:02 2006
@@ -19,16 +19,17 @@
<faqs title="Frequently Asked Questions">
- <part id="general-questions">
- <title>General Questions</title>
+ <part id="configuration">
+ <title>Configuration</title>
<faq id="required-jars">
<question>What jars are required by JCS?</question>
<answer>
<p>
- As of verison 1.2.7.0, the core of JCS
(the LRU memory cache, the indexed
- disk cache, the TCP lateral, and the
RMI remote
- server) requires only two other jars.
+ As of verison 1.2.7.0, the core of JCS
(the LRU
+ memory cache, the indexed disk cache,
the TCP
+ lateral, and the RMI remote server)
requires only
+ two other jars.
</p>
<p>
<a
@@ -37,9 +38,12 @@
</a>
</p>
<p>commons-logging</p>
-
- <p>Versions 1.2.6.9 and below also require the
following two additional jars:</p>
-
+
+ <p>
+ Versions 1.2.6.9 and below also require
the
+ following two additional jars:
+ </p>
+
<p>commons-collections</p>
<p>commons-lang</p>
<p>
@@ -65,24 +69,25 @@
<question>
How can I configure JCS with my own properties?
</question>
+
+ <answer>
+ <p>
+ You don't have to put the cache.ccf
file in the
+ classpath; instead you can do the
following:
+ </p>
+ <code>
+ CompositeCacheManager ccm =
+
CompositeCacheManager.getUnconfiguredInstance();
+
+ Properties props = new Properties();
+
+ props.load(/* load properties from some
location
+ defined by your app */);
+
+ ccm.configure(props);
+ </code>
+ </answer>
</faq>
- <answer>
- <p>
- You don't have to put the cache.ccf file in the
- classpath; instead you can do the following:
- </p>
- <code>
- CompositeCacheManager ccm =
- CompositeCacheManager.getUnconfiguredInstance();
-
- Properties props = new Properties();
-
- props.load(/* load properties from some
location defined
- by your app */);
-
- ccm.configure(props);
- </code>
- </answer>
<faq id="configuration-system-properties">
<question>
@@ -98,6 +103,10 @@
</p>
</answer>
</faq>
+ </part>
+
+ <part id="general-questions">
+ <title>General Questions</title>
<faq id="jcs-vs-ehcache">
<question>Is JCS faster than EHCache?</question>
@@ -109,9 +118,102 @@
1.2-beta4 at gets and puts. The EHCache
benchmark
data is unsubstantiated and very old.
As such the
EHCache site benchmark data is
completely
- inaccurate. <a
href="JCSvsEHCache.html">Read More</a>
+ inaccurate.
+ <a href="JCSvsEHCache.html">Read
More</a>
+ </p>
+ </answer>
+ </faq>
+
+ <faq id="admin-jsp">
+ <question>Where can I get the admin jsp?</question>
+ <answer>
+ <p>
+ You can download the admin jsp
+ <a
href="http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdmin.jsp">here</a>.
+ </p>
+ </answer>
+ </faq>
+ </part>
+
+ <part id="elements">
+ <title>Elements</title>
+
+ <faq id="element-attributes">
+ <question>How do I set the element
attributes?</question>
+ <answer>
+ <p>
+ Every element put into the cache has
its own set of
+ attributes. By default elements are
given a copy of
+ the default element attributes
associated with a
+ region. You can also specify the
attributes to use
+ for an element when you put it in the
cache. See
+ <a href="ElementAttributes.html">
+ Element Attributes
+ </a>
+ for more information on the attributes
that are
+ available.
+ </p>
+ </answer>
+ </faq>
+
+ <faq id="element-events">
+ <question>How do I register an element event?</question>
+ <answer>
+ <p>
+ Element event handlers must be added to
the element
+ attributes. See
+ <a href="ElementEventHandling.html">
+ Element Event Handling
+ </a>
+ for more information on how to handle
element
+ events.
+ </p>
+ </answer>
+ </faq>
+ </part>
+
+ <part id="indexed-disk-cache">
+ <title>Indexed Disk Cache</title>
+
+ <faq id="thread-pool">
+ <question>
+ How do I limit the number of threads used by
the disk
+ cache?
+ </question>
+ <answer>
+ <p>
+ The indexed disk cache uses an event
queue for each
+ region. By default these queues are
worked by their
+ own dedicated threads. Hence, you will
have one
+ thread per disk cache region. Although
the queues
+ kill off idle threads, you may want to
limit the
+ overall number of threads used by the
queues. You
+ can do this by telling the disk cache
to use a
+ thread pool. The configuration is
described
+ <a href="IndexedDiskAuxCache.html">
+ on the disk cache configuration
page
+ </a>
+ .
+ </p>
+ </answer>
+ </faq>
+ </part>
+
+
+ <part id="remote-cache-server">
+ <title>Remote Cache Server</title>
+
+ <faq id="classes">
+ <question>
+ Do I need to put my jars in the classpath of
the
+ remote server?
+ </question>
+ <answer>
+ <p>
+ No. The remote server never deserializes your
classes.
</p>
</answer>
</faq>
</part>
+
</faqs>
Modified: jakarta/jcs/trunk/xdocs/index.xml
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/index.xml?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/index.xml (original)
+++ jakarta/jcs/trunk/xdocs/index.xml Mon Feb 20 12:04:02 2006
@@ -1,53 +1,205 @@
<?xml version="1.0"?>
<document>
- <properties>
- <title>Java Caching System</title>
- <author email="pete@xxxxxxxxxxx">Pete Kazmier</author>
- <author email="asmuts@xxxxxxxxxx">Aaron Smuts</author>
- </properties>
-
- <body>
- <section name="Java Caching System">
- <p>
- JCS is a distributed caching system written in java. It is intended
to speed up
- applications by providing a means to manage cached
- data of various dynamic natures. Like any caching system, the
- JCS is most useful for high read, low put applications. Dynamic
- content and reporting systems can benefit most. However, any
- site that repeatedly constructs pages, dropdowns, or common
- search results from a database that is updated at intervals
- (rather than across categories continuously) can improve
- performance and scalability by implementing caching. Latency
- times drop sharply and bottlenecks move away from the database
- in an effectively cached system.
- </p>
- <p>
- The JCS goes beyond simply caching objects in memory. It
- provides several important features, necessary for any
- Enterprise level caching system:
- </p>
- <ul>
- <li>Memory management</li>
- <li>Disk overflow (and defragmentation)</li>
- <li>Element grouping</li>
- <li>Quick nested categorical removal</li>
- <li>Data expiration</li>
- <li>Extensible framework</li>
- <li>Fully configurable runtime parameters</li>
- <li>Remote synchronization</li>
- <li>Remote store recovery</li>
- <li>Non-blocking "zombie" (balking facade) pattern</li>
- <li>Optional lateral distribution of elements via HTTP, TCP, or
- UDP</li>
- <li>Remote server chaining (or clustering) and failover</li>
- </ul>
- <p>
- These features provide a framework with no point of failure,
- allowing for full session failover including session data across
- multiple servers.
- </p>
- </section>
- </body>
+ <properties>
+ <title>Java Caching System</title>
+ <author email="asmuts@xxxxxxxxxx">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="Java Caching System">
+ <p>
+ JCS is a distributed caching system written in
java. It
+ is intended to speed up applications by
providing a
+ means to manage cached data of various dynamic
natures.
+ Like any caching system, JCS is
+ <a href="UsingJCSBasicWeb.html">most useful</a>
+ for high read, low put applications. Latency
times drop
+ sharply and bottlenecks move away from the
database in
+ an effectively cached system.
+ <a href="getting_started/intro.html">
+ Learn how to start using JCS.
+ </a>
+ </p>
+ <p>
+ The JCS goes beyond simply caching objects in
memory. It
+ provides numerous additional features:
+ </p>
+ <ul>
+ <li>Memory management</li>
+ <li>Disk overflow (and defragmentation)</li>
+ <li>Thread pool controls</li>
+ <li>Element grouping</li>
+ <li>Minimal dependencies</li>
+ <li>Quick nested categorical removal</li>
+ <li>Data expiration (idle time and max
life)</li>
+ <li>Extensible framework</li>
+ <li>Fully configurable runtime parameters</li>
+ <li>Region data separation and
configuration</li>
+ <li>Fine grained element configuration
options</li>
+ <li>Remote synchronization</li>
+ <li>Remote store recovery</li>
+ <li>Non-blocking "zombie" (balking facade)
pattern</li>
+ <li>
+ Lateral distribution of elements via
HTTP, TCP, or
+ UDP
+ </li>
+ <li>UDP Discovery of other caches</li>
+ <li>Element event handling</li>
+ <li>
+ Remote server chaining (or clustering)
and failover
+ </li>
+ </ul>
+ <p>
+ JCS works on JDK versions 1.3 and up. It only
has two
+ dependencies: Commons Logging and Doug Lea's
Util
+ Concurrent.
+ </p>
+ </section>
+
+ <section name="JCS is a Composite Cache">
+ <p>
+ The foundation of JCS is the Composite Cache,
which is
+ the
+ <a href="Plugins.html">pluggable</a>
+ controller for a cache region. Four types of
caches can
+ be plugged into the Composite Cache for any
given
+ region: (1) Memory, (2) Disk, (3) Lateral, and
(4)
+ Remote. The Composite Cache orchestrates access
to the
+ various caches configured for use in a region.
+ </p>
+ <p>
+ The JCS jar provides production ready
implementations of
+ each of the four types of caches. In addtion to
the core
+ four, JCS also provides additional plugins of
each type.
+ </p>
+
+ <subsection name="LRU Memory Cache">
+ <p>
+ The LRU Memory Cache is an extremely
fast, highly
+ configurable
+ <a href="RegionProperties.html">
+ memory cache
+ </a>
+ . It uses a Least Recently Used
algorithm to manage
+ the number of items that can be stored
in memory.
+ The LRU Memory Cache uses its own LRU
Map
+ implementation that is significantly
faster than
+ both the commons LRUMap implementation
and the
+ LinkedHashMap that is provided with
JDK1.4 up. This
+ makes JCS faster than its
+ <a
href="JCSvsEHCache.html">competitors</a>
+ .
+ </p>
+ </subsection>
+
+ <subsection name="Indexed Disk Cache">
+ <p>
+ The
+ <a href="IndexedDiskAuxCache.html">
+ Indexed Disk Cache
+ </a>
+ is a fast, reliable, and
+ <a
href="IndexedDiskCacheProperties.html">
+ highly configurable
+ </a>
+ swap for cached data. The indexed disk
cache follows
+ the fastest pattern for disk swapping.
Cache
+ elements are written to disk via a
continuous
+ queue-based process. The length of the
item is
+ stored in the first few bytes of the
entry. The
+ offset is stored in memory and can be
reference via
+ the key. When items are removed from
the disk cache,
+ the location and size are recorded and
reused when
+ possible. Every aspect of the disk
cache is
+ configurable, and a thread pool can be
used to
+ reduce the number of queue worker
threads across the
+ system.
+ </p>
+ </subsection>
+
+ <subsection name="TCP Lateral Cache">
+ <p>
+ The
+ <a href="LateralTCPAuxCache.html">
+ TCP Lateral Cache
+ </a>
+ provides an easy way to distribute
cached data to
+ multiple servers. It comes with a
+ <a href="LateralUDPDiscovery.html">UDP
discovery</a>
+ mechanism, so you can add nodes without
having to
+ reconfigure the entire farm. The TCP
Lateral Cache
+ works by establishing connections with
socket server
+ running on other nodes. Each node
maintains a
+ connection to every other. Only one
server is needed
+ for any number of regions. The client
is able to
+ re-establish connections if it looses
its connection
+ with another server. The TCP Lateral is
+ <a href="LateralTCPProperties.html">
+ highly configurable
+ </a>
+ . You can choose to only send data, to
not look for
+ data on other servers, to send removes
instead of
+ puts, and to filter removes based on
hash codes.
+ </p>
+ </subsection>
+
+ <subsection name="RMI Remote Cache">
+ <p>
+ JCS also provides an RMI based
+ <a href="RemoteAuxCache.html">
+ Remote Cache Server
+ </a>
+ . Rather than having each node connect
to every
+ other node, you can use the remote
cache server as
+ the connection point. Each node
connects to the
+ remove server, which then broadcasts
events to the
+ other nodes. To maintain consistency
across a
+ cluster without incurring the overhead
of
+ serialization, you can decide to send
invalidation
+ messages to the other locals rather
than send the
+ object over the wire. The remote cache
server holds
+ a serialized version of your objects,
so it does not
+ need to be deployed with your class
libraries. The
+ remote servers can be chained and a
list of failover
+ servers can be configured on the client.
+ </p>
+ </subsection>
+ </section>
+
+ <section name="What JCS is not">
+ <p>
+ JCS is not a tag library or a web specific
application.
+ JCS is a general purpose caching system that
can be used
+ in web applications, services, and stand alone
Java
+ applications.
+ </p>
+ <p>
+ JCS is not a transactional distribution
mechanism.
+ Transactional distributed caches are not
scalable. JCS
+ is a cache not a database. The distribution
mechanisms
+ provided by JCS can scale into the tens of
servers. In a
+ well-designed service oriented architecture,
JCS can be
+ used in a high demand service with numerous
nodes. This
+ would not be possible is the distribution
mechanism were
+ transactional.
+ </p>
+ <p>
+ JCS does not use AOP. JCS is a high performance,
+ non-invasive cache. It does not manipulate your
objects
+ so it can just send a field or two fewer over
the wire.
+ </p>
+ <p>
+ JCS is not fork, an offshoot, a branch, or any
other
+ derivation of JCS. Nor is JCS named after
another
+ library. JCS is a mature project that has been
under
+ development and in use since 2001. Over the
years JCS
+ has encorporated numerous bug fixes and has
added dozens
+ of features, making it the best designed and
most
+ feature rich caching solution available.
+ </p>
+ </section>
+
+ </body>
</document>
Modified: jakarta/jcs/trunk/xdocs/navigation.xml
URL:
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/xdocs/navigation.xml?rev=379217&r1=379216&r2=379217&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/navigation.xml (original)
+++ jakarta/jcs/trunk/xdocs/navigation.xml Mon Feb 20 12:04:02 2006
@@ -32,6 +32,8 @@
href="/BasicJCSConfiguration.html" />
<item name="Element Config"
href="/ElementAttributes.html" />
+ <item name="Element Event Handling"
+ href="/ElementEventHandling.html" />
<item name="Region Properties"
href="/RegionProperties.html" />
<item name="Basic Web Example"
|