Arrays.sort( list );
for ( int i = 0; i < list.length; i++ )
{
String name = list[i];
ICache cache = cacheMgr.getCache( name );
cache.removeAll();
}
out.println( "All caches have been cleared!" );
}
else
{
ICache cache = cacheMgr.getCache( hashtableName );
String task = ( String ) params.get( "task" );
if ( task == null )
{
task = "delete";
}
if ( task.equalsIgnoreCase( "stats" ) )
{
out.println( "<br><br>" );
out.println( "<b>Stats for " + hashtableName + ":</b><br>" );
out.println( cache.getStats() );
out.println( "<br>" );
}
else
{
// Remove the specified cache.
if ( key != null )
{
if ( key.toUpperCase().equals( "ALL" ) )
{
cache.removeAll();
if ( log.isDebugEnabled() )
{
log.debug( "Removed all elements from " + hashtableName );
}
out.println( "key = " + key );
}
else
{
if ( log.isDebugEnabled() )
{
log.debug( "key = " + key );
}
out.println( "key = " + key );
StringTokenizer toke = new StringTokenizer( key, "_" );
while ( toke.hasMoreElements() )
{
String temp = ( String ) toke.nextElement();
cache.remove( key );
if ( log.isDebugEnabled() )
{
log.debug( "Removed " + temp + " from " + hashtableName );
}
}
}
}
else
{
out.println( "key is null" );
}
}
// end is task == delete
}
}
else
{
out.println( "(No hashTableName specified.)" );
}
// PRINT OUT MENU
out.println( "<br>" );
int antiCacheRandom = ( int ) ( 10000.0 * Math.random() );
out.println( "<a href=?antiCacheRandom=" + antiCacheRandom
+ ">List all caches</a><br>" );
out.println( "<br>" );
out.println( "<a href=?hashtableName=ALL&key=ALL&antiCacheRandom="
+ antiCacheRandom
+ "><font color=RED>Clear All Cache Regions</font></a><br>" );
out.println( "<br>" );
String[] list = cacheMgr.getCacheNames();
Arrays.sort( list );
out.println( "<div align=CENTER>" );
out.println( "<table border=1 width=80%>" );
out.println( "<tr bgcolor=#eeeeee><td>Cache Region Name</td><td>Size</td><td>Status</td><td>Stats</td>" );
for ( int i = 0; i < list.length; i++ )
{
String name = list[i];
out.println( "<tr><td><a href=?hashtableName=" + name + "&key=ALL&antiCacheRandom="
+ antiCacheRandom + ">" + name + "</a></td>" );
ICache cache = cacheMgr.getCache( name );
out.println( "<td>" );
out.print( cache.getSize() );
out.print( "</td><td>" );
int status = cache.getStatus();
out.print( status == ICache.STATUS_ALIVE ? "ALIVE"
: status == ICache.STATUS_DISPOSED ? "DISPOSED"
: status == ICache.STATUS_ERROR ? "ERROR"
: "UNKNOWN" );
out.print( "</td>" );