jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control CompositeCache.java
Date Fri, 16 Jul 2004 01:29:07 GMT
asmuts      2004/07/15 18:29:07

  Modified:    src/java/org/apache/jcs/engine/control CompositeCache.java
  Log:
  added stats
  
  no insert into memory from disk if size is 0
  
  Revision  Changes    Path
  1.16      +42 -9     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CompositeCache.java	14 Jul 2004 03:36:02 -0000	1.15
  +++ CompositeCache.java	16 Jul 2004 01:29:07 -0000	1.16
  @@ -538,8 +538,17 @@
                                   auxHitCountByIndex[ i ]++;
   
                                   // Spool the item back into memory
  -
  -                                memCache.update( element );
  +                                // only spool if the mem cache size is greater than
  +                                // 0, else the item will immediately get put into purgatory
  +                                if ( memCache.getCacheAttributes().getMaxObjects() >
0 )
  +                                {
  +                                  memCache.update(element);
  +                                } else {
  +                                  if ( log.isDebugEnabled() ) {
  +                                    log.debug( "Skipping memory update since" +
  +                                               "no items are allowed in memory" );
  +                                  }
  +                                }
                               }
   
                               found = true;
  @@ -881,14 +890,14 @@
                   log.error( "Failure disposing of aux", ex );
               }
   
  -        }
  +          try {
  +            memCache.dispose();
  +          }
  +          catch ( IOException ex )
  +          {
  +              log.error( "Failure disposing of memCache", ex );
  +          }
   
  -        try {
  -          memCache.dispose();
  -        }
  -        catch ( IOException ex )
  -        {
  -            log.error( "Failure disposing of memCache", ex );
           }
   
           log.warn( "Called close for " + cacheName );
  @@ -976,6 +985,30 @@
       {
           return alive ? CacheConstants.STATUS_ALIVE : CacheConstants.STATUS_DISPOSED;
       }
  +
  +    /**
  +     * Gets stats for debugging.
  +     * @return String
  +     */
  +    public String getStats()
  +    {
  +      StringBuffer buf = new StringBuffer();
  +      buf.append( "\n -------------------------" );
  +      buf.append( "\n Composite Cache:" );
  +      buf.append("\n HitCountRam = " + getHitCountRam());
  +      buf.append("\n HitCountAux = " + getHitCountAux());
  +
  +      buf.append(getMemoryCache().getStats());
  +
  +      for ( int i = 0; i < auxCaches.length; i++ )
  +      {
  +        ICache aux = auxCaches[i];
  +        buf.append(aux.getStats());
  +      }
  +
  +      return buf.toString();
  +  }
  +
   
       /**
        *  Gets the cacheName attribute of the Cache object
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org


Mime
View raw message