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/stats/behavior ICacheStats.java
Date Wed, 18 May 2005 01:27:31 GMT
asmuts      2005/05/17 18:27:31

  Modified:    src/java/org/apache/jcs/engine ElementAttributes.java
               src/java/org/apache/jcs/engine/behavior
                        IElementAttributes.java ICacheElement.java
               .        project.xml
               xdocs    Downloads.xml
               src/java/org/apache/jcs/engine/control CompositeCache.java
               src/java/org/apache/jcs/access CacheAccess.java
               src/java/org/apache/jcs/engine/stats/behavior
                        ICacheStats.java
  Added:       .        maven13.bat
               src/test/org/apache/jcs TestCacheElementRetrieval.java
               tempbuild jcs-1.2.6.jar
  Log:
  Added a method to cacheAccess that lets you get teh wrapper fromt he cache.  This is very
useful.
  Added a simple test for this.
  Updated the mailing list links.
  Added links to old archive.
  Updated version to 1.2.6
  Added a jcs-1.2.6 jar to the tempbuilds.
  Updated Javadocs.
  Added method to get raw stats from the CacheAccess
  
  Revision  Changes    Path
  1.10      +49 -105   jakarta-turbine-jcs/src/java/org/apache/jcs/engine/ElementAttributes.java
  
  Index: ElementAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/ElementAttributes.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElementAttributes.java	4 Mar 2005 05:20:53 -0000	1.9
  +++ ElementAttributes.java	18 May 2005 01:27:31 -0000	1.10
  @@ -39,13 +39,6 @@
   {
   
       /**
  -     * Is this item distributable at all.
  -     */
  -    public boolean   IS_DISTRIBUTE  = true;
  -
  -    // lateral
  -
  -    /**
        * can this item be flushed to disk
        */
       public boolean   IS_SPOOL       = true;
  @@ -122,8 +115,6 @@
           // waterfal onto disk, for pure disk set memory to 0
           IS_SPOOL = attr.IS_SPOOL;
   
  -        IS_DISTRIBUTE = attr.IS_DISTRIBUTE;
  -
           // lateral
           IS_LATERAL = attr.IS_LATERAL;
   
  @@ -151,7 +142,6 @@
               ElementAttributes attr = new ElementAttributes();
               attr.setIdleTime( this.getIdleTime() );
               attr.setIsEternal( this.getIsEternal() );
  -            attr.setIsDistribute( this.getIsDistribute() );
               attr.setIsLateral( this.getIsLateral() );
               attr.setIsRemote( this.getIsRemote() );
               attr.setIsSpool( this.getIsSpool() );
  @@ -197,76 +187,63 @@
           return null;
       }
   
  -    /**
  -     * Sets the version attribute of the IElementAttributes object
  -     *
  -     * @param version
  -     *            The new version value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setVersion(long)
        */
       public void setVersion( long version )
       {
           this.version = version;
       }
   
  -    /**
  -     * Sets the maxLifeSeconds attribute of the IElementAttributes object
  -     *
  -     * @param mls
  -     *            The new {3} value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setMaxLifeSeconds(long)
        */
       public void setMaxLifeSeconds( long mls )
       {
           this.mls = mls;
       }
   
  -    /**
  -     * Gets the {3} attribute of the ElementAttributes object
  -     *
  -     * @return The {3} value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getMaxLifeSeconds()
        */
       public long getMaxLifeSeconds()
       {
           return this.mls;
       }
   
  -    /**
  -     * Sets the idleTime attribute of the IElementAttributes object
  -     *
  -     * @param idle
  -     *            The new idleTime value
  -     */
  +	/*
  +	 *  (non-Javadoc)
  +	 * @see org.apache.jcs.engine.behavior.IElementAttributes#setIdleTime(long)
  +	 */
       public void setIdleTime( long idle )
       {
           this.idle = idle;
       }
   
  -    //public void setListener( int event, CacheEventListener listerner) {}
  -
  -    /**
  -     * Size in bytes.
  -     *
  -     * @param size
  -     *            The new size value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setSize(int)
        */
       public void setSize( int size )
       {
           this.size = size;
       }
   
  -    /**
  -     * Gets the size attribute of the IElementAttributes object
  -     *
  -     * @return The size value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getSize()
        */
       public int getSize()
       {
           return size;
       }
   
  -    /**
  -     * Gets the createTime attribute of the IElementAttributes object
  -     *
  -     * @return The createTime value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getCreateTime()
        */
       public long getCreateTime()
       {
  @@ -281,32 +258,27 @@
           createTime = System.currentTimeMillis();
       }
   
  -    /**
  -     * Gets the version attribute of the IElementAttributes object
  -     *
  -     * @return The version value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getVersion()
        */
       public long getVersion()
       {
           return version;
       }
   
  -    /**
  -     * Gets the idleTime attribute of the IElementAttributes object. Keeping
  -     * track of this will require storing the last access time. This could get
  -     * expensive.
  -     *
  -     * @return The idleTime value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getIdleTime()
        */
       public long getIdleTime()
       {
           return this.idle;
       }
   
  -    /**
  -     * If the returned value is negative, the item has expired
  -     *
  -     * @return The timeToLive value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getTimeToLiveSeconds()
        */
       public long getTimeToLiveSeconds()
       {
  @@ -315,81 +287,54 @@
                                            * 1000)) - now) / 1000;
       }
   
  -    /**
  -     * Gets the LastAccess attribute of the IAttributes object
  -     *
  -     * @return The LastAccess value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getLastAccessTime()
        */
       public long getLastAccessTime()
       {
           return this.lastAccessTime;
       }
   
  -    /**
  -     * Sets the LastAccessTime as now of the IElementAttributes object
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setLastAccessTimeNow()
        */
       public void setLastAccessTimeNow()
       {
           this.lastAccessTime = System.currentTimeMillis();
       }
   
  -    /**
  -     * Gets the {3} attribute of the IElementAttributes object
  -     *
  -     * @return The {3} value
  -     */
  -    public boolean getIsDistribute()
  -    {
  -        return this.IS_DISTRIBUTE;
  -    }
  -
  -    /**
  -     * Sets the isDistribute attribute of the ElementAttributes object
  -     *
  -     * @param val
  -     *            The new isDistribute value
  -     */
  -    public void setIsDistribute( boolean val )
  -    {
  -        this.IS_DISTRIBUTE = val;
  -    }
  -
  -    /**
  -     * can this item be flushed to disk
  -     *
  -     * @return The {3} value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getIsSpool()
        */
       public boolean getIsSpool()
       {
           return this.IS_SPOOL;
       }
   
  -    /**
  -     * Sets the isSpool attribute of the ElementAttributes object
  -     *
  -     * @param val
  -     *            The new isSpool value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setIsSpool(boolean)
        */
       public void setIsSpool( boolean val )
       {
           this.IS_SPOOL = val;
       }
   
  -    /**
  -     * Is this item laterally distributable
  -     *
  -     * @return The {3} value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#getIsLateral()
        */
       public boolean getIsLateral()
       {
           return this.IS_LATERAL;
       }
   
  -    /**
  -     * Sets the isLateral attribute of the ElementAttributes object
  -     *
  -     * @param val
  -     *            The new isLateral value
  +    /*
  +     *  (non-Javadoc)
  +     * @see org.apache.jcs.engine.behavior.IElementAttributes#setIsLateral(boolean)
        */
       public void setIsLateral( boolean val )
       {
  @@ -484,7 +429,6 @@
        *
        * @return The elementEventHandlers value
        */
  -
       public ArrayList getElementEventHandlers()
       {
           return this.eventHandlers;
  
  
  
  1.7       +62 -47    jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
  
  Index: IElementAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IElementAttributes.java	21 Apr 2004 01:00:43 -0000	1.6
  +++ IElementAttributes.java	18 May 2005 01:27:31 -0000	1.7
  @@ -21,7 +21,9 @@
   import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
   
   /**
  - *  Inteface for cache element attributes classes.
  + *  Interface for cache element attributes classes.  Every item is the cache is associated
with 
  + * an element attributes object.  It is used to track the life of the object as well as
to restrict 
  + * its behavior.  By default, elements get a clone of the region's attributes.  
    *
    */
   public interface IElementAttributes
  @@ -35,30 +37,37 @@
     public void setVersion( long version );
   
     /**
  -   *  Sets the maxLife attribute of the IAttributes object
  +   *  Sets the maxLife attribute of the IAttributes object.  
      *
  -   *@param  mls  The new {3} value
  +   *@param  mls  The new MaxLifeSeconds value
      */
     public void setMaxLifeSeconds( long mls );
   
     /**
  -   *  Sets the maxLife attribute of the IAttributes object
  +   *  Sets the maxLife attribute of the IAttributes object.  
  +   * How many seconds it can live after creation.
  +   * <p>
  +   * If this is exceeded the element will not be returned, instead it will be removed.
  +   * It will be removed on retrieval, or removed actively if the memory shrinker is turned
on.
  +   * 
      *
  -   *@return    The {3} value
  +   *@return    The MaxLifeSeconds value
      */
     public long getMaxLifeSeconds();
   
     /**
  -   *  Sets the idleTime attribute of the IAttributes object
  +   *  Sets the idleTime attribute of the IAttributes object.  This is the maximum
  +   * time the item can be idle in the cache, that is not accessed.
  +   * <p>
  +   * If this is exceeded the element will not be returned, instead it will be removed.
  +   * It will be removed on retrieval, or removed actively if the memory shrinker is turned
on.
      *
      *@param  idle  The new idleTime value
      */
     public void setIdleTime( long idle );
   
  -  //public void setListener( int event, CacheEventListener listerner) {}
  -
     /**
  -   *  Size in bytes.
  +   *  Size in bytes.  This is not used except in the admin pages.  It will be -1 by default.
      *
      *@param  size  The new size value
      */
  @@ -72,16 +81,21 @@
     public int getSize();
   
     /**
  -   *  Gets the createTime attribute of the IAttributes object
  +   *  Gets the createTime attribute of the IAttributes object.  
  +   * <p>
  +   * This shoudd be the current time in milliseconds returned by the sysutem call when
the element is
  +   * put in the cache.
  +   * <p>
  +   * Putting an item in the cache overrides any existing items.
      *
      *@return    The createTime value
      */
     public long getCreateTime();
   
     /**
  -   *  Gets the LastAccess attribute of the IAttributes object
  +   *  Gets the LastAccess attribute of the IAttributes object.
      *
  -   *@return    The LastAccess value
  +   *@return    The LastAccess value.
      */
     public long getLastAccessTime();
   
  @@ -105,9 +119,11 @@
     public long getIdleTime();
   
     /**
  -   *  Gets the time left to live of the IAttributes object
  +   *  Gets the time left to live of the IAttributes object.
  +   * <p>
  +   * This is the (max life + create time) - current time.
      *
  -   *@return    The t value
  +   *@return    The TimeToLiveSeconds value
      */
     public long getTimeToLiveSeconds();
   
  @@ -118,68 +134,66 @@
      */
     public IElementAttributes copy();
   
  -  /**
  -   *  Gets the {3} attribute of the IElementAttributes object
  -   *
  -   *@return    The {3} value
  -   */
  -  public boolean getIsDistribute();
  -
  -  /**
  -   *  Sets the isDistribute attribute of the IElementAttributes object
  -   *
  -   *@param  val  The new isDistribute value
  -   */
  -  public void setIsDistribute( boolean val );
  -
  -  // lateral
   
     /**
  -   *  can this item be flushed to disk
  -   *
  -   *@return    The {3} value
  +   *  Can this item be spooled to disk
  +   * <p>
  +   * By default this is true.
  +   * 
  +   *@return    The spoolable value
      */
     public boolean getIsSpool();
   
     /**
      *  Sets the isSpool attribute of the IElementAttributes object
  -   *
  +   * <p>
  +   * By default this is true.
  +   * 
      *@param  val  The new isSpool value
      */
     public void setIsSpool( boolean val );
   
     /**
  -   *  Is this item laterally distributable
  -   *
  -   *@return    The {3} value
  +   *  Is this item laterally distributable.  Can it be sent to 
  +   *  auxiliaries of type lateral.
  +   * <p>
  +   * By default this is true.
  +   * 
  +   *@return    The isLateral value
      */
     public boolean getIsLateral();
   
     /**
      *  Sets the isLateral attribute of the IElementAttributes object
  -   *
  +   * <p>
  +   * By default this is true.
  +   * 
      *@param  val  The new isLateral value
      */
     public void setIsLateral( boolean val );
   
     /**
  -   *  Can this item be sent to the remote cache
  -   *
  -   *@return    The {3} value
  +   *  Can this item be sent to the remote cache.
  +   * <p>
  +   * By default this is true.
  +   * 
  +   *@return    The isRemote value
      */
     public boolean getIsRemote();
   
     /**
  -   *  Sets the isRemote attribute of the IElementAttributes object
  +   *  Sets the isRemote attribute of the IElementAttributes object.
  +   * <p>
  +   * By default this is true.
      *
      *@param  val  The new isRemote value
      */
     public void setIsRemote( boolean val );
   
     /**
  -   *  can turn off expiration
  +   *  This turns off expiration if it is true.
      *
  -   *@return    The {3} value
  +   *@return    The IsEternal value
      */
     public boolean getIsEternal();
   
  @@ -200,10 +214,13 @@
   
     /**
      *  Gets the elementEventHandlers.
  +   * <p>
  +   * Event handlers are transient.  The only events defined are in memory events.
  +   * All handlers are lost if the item goes to disk.
      *
  -   *@return    The elementEventHandlers value
  +   *@return    The elementEventHandlers value, null if there are none
      */
  -
  +  public ArrayList getElementEventHandlers();
   
     /**
      *  Sets the eventHandlers of the IElementAttributes object
  @@ -212,6 +229,4 @@
      */
     public void addElementEventHandlers( ArrayList eventHandlers );
   
  -  public ArrayList getElementEventHandlers();
  -
   }
  
  
  
  1.5       +9 -3      jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheElement.java
  
  Index: ICacheElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ICacheElement.java	15 Apr 2004 19:22:53 -0000	1.4
  +++ ICacheElement.java	18 May 2005 01:27:31 -0000	1.5
  @@ -23,15 +23,21 @@
   import org.apache.jcs.engine.behavior.IElementAttributes;
   
   /**
  - * Description of the Interface
  + * Every item is the cache is wrapped in an ICacheElement.  This 
  + * contains information about the element: the region name, the key, 
  + * the value, and the element attributes.  
  + * <p>
  + * The element attributes have lots of useful information
  + * about each elment, such as when they were created, how long they have to live,
  + * and if they are allowed to be spooled, etc.
    *
    */
   public interface ICacheElement extends Serializable
   {
  -    //, Cloneable
   
       /**
  -     * Gets the cacheName attribute of the ICacheElement object
  +     * Gets the cacheName attribute of the ICacheElement object.
  +     * The cacheName is also known as the region name.
        *
        * @return The cacheName value
        */
  
  
  
  1.51      +20 -7     jakarta-turbine-jcs/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/project.xml,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- project.xml	14 Mar 2005 08:37:43 -0000	1.50
  +++ project.xml	18 May 2005 01:27:31 -0000	1.51
  @@ -5,7 +5,7 @@
     <pomVersion>3</pomVersion>
     <name>JCS</name>
     <id>jcs</id>
  -  <currentVersion>1.2.5-dev</currentVersion>
  +  <currentVersion>1.2.6</currentVersion>
     <organization>
       <name>Apache Software Foundation</name>
       <url>http://jakarta.apache.org/</url>
  @@ -38,15 +38,27 @@
     <mailingLists>
       <mailingList>
         <name>JCS User List</name>
  -      <subscribe>turbine-jcs-user-subscribe@jakarta.apache.org</subscribe>
  -      <unsubscribe>turbine-jcs-user-unsubscribe@jakarta.apache.org</unsubscribe>
  -      <archive>http://mail-archives.apache.org/eyebrowse/SummarizeList?listName=turbine-jcs-user@jakarta.apache.org</archive>
  +      <subscribe>jcs-users-subscribe@jakarta.apache.org</subscribe>
  +      <unsubscribe>jcs-users-unsubscribe@jakarta.apache.org</unsubscribe>
  +      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-jcs-users/</archive>
       </mailingList>
       <mailingList>
         <name>JCS Developer List</name>
  -      <subscribe>turbine-jcs-dev-subscribe@jakarta.apache.org</subscribe>
  -      <unsubscribe>turbine-jcs-dev-unsubscribe@jakarta.apache.org</unsubscribe>
  -      <archive>http://mail-archives.apache.org/eyebrowse/SummarizeList?listName=turbine-jcs-dev@jakarta.apache.org</archive>
  +      <subscribe>jcs-dev-subscribe@jakarta.apache.org</subscribe>
  +      <unsubscribe>jcs-dev-unsubscribe@jakarta.apache.org</unsubscribe>
  +      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-jcs-dev/</archive>
  +    </mailingList>
  +    <mailingList>
  +      <name>OLD User list</name>
  +      <subscribe></subscribe>
  +      <unsubscribe></unsubscribe>
  +      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-turbine-jcs-user/</archive>
  +    </mailingList>
  +    <mailingList>
  +      <name>OLD Developer list</name>
  +      <subscribe></subscribe>
  +      <unsubscribe></unsubscribe>
  +      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-turbine-jcs-dev/</archive>
       </mailingList>
     </mailingLists>
   
  @@ -170,6 +182,7 @@
       <resources/>
       <unitTest>
         <includes>
  +        <include>**/TestCacheElementRetrieval.java</include>
           <include>**/TestDiskCacheNoMemory.java</include>
           <include>**/TestJCS.java</include>
           <include>**/TestSimpleLoad.java</include>
  
  
  
  1.1                  jakarta-turbine-jcs/maven13.bat
  
  Index: maven13.bat
  ===================================================================
  set JAVA_HOME=C:\Java\jdk1.3
  
  maven %1 %2
  
  
  1.2       +2 -0      jakarta-turbine-jcs/xdocs/Downloads.xml
  
  Index: Downloads.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/xdocs/Downloads.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Downloads.xml	9 Mar 2005 05:37:22 -0000	1.1
  +++ Downloads.xml	18 May 2005 01:27:31 -0000	1.2
  @@ -15,6 +15,8 @@
         <p> 
        	For now, you can find versioned binary releases of JCS in 
        	the tempbuild directory of the repository.  
  +      </p>
  +      <p>      	
           <a href="http://cvs.apache.org/viewcvs.cgi/jakarta-turbine-jcs/tempbuild/">HERE</a>
         </p>
         <p> 
  
  
  
  1.1                  jakarta-turbine-jcs/src/test/org/apache/jcs/TestCacheElementRetrieval.java
  
  Index: TestCacheElementRetrieval.java
  ===================================================================
  package org.apache.jcs;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License")
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  import org.apache.jcs.engine.behavior.ICacheElement;
  
  import junit.framework.TestCase;
  
  /**
   * @author Aaron Smuts
   *
   */
  public class TestCacheElementRetrieval extends TestCase {
  
  	
  	public void testSimpleElementRetrieval() throws Exception
  	{
          JCS jcs = JCS.getInstance( "testCache1" );
          
          jcs.put( "test_key", "test_data" );
          
          long now = System.currentTimeMillis();
          ICacheElement elem = jcs.getCacheElement( "test_key" );
          assertEquals( "Name wasn't right", "testCache1", elem.getCacheName() );
          
          long diff = elem.getElementAttributes().getCreateTime() - now;
          assertTrue ( "Create time should have been at or after the call", now >= 0 );
                  
  	}
  	
  }
  
  
  
  1.24      +7 -5      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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CompositeCache.java	1 Feb 2005 00:01:58 -0000	1.23
  +++ CompositeCache.java	18 May 2005 01:27:31 -0000	1.24
  @@ -57,8 +57,10 @@
   import org.apache.jcs.engine.control.group.GroupId;
   
   /**
  - * This is the primary hub for a single cache/region. It control the flow of
  + * 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.
  + * <p>
  + * This is the core of a JCS region.
    * 
    * @version $Id$
    */
  @@ -79,7 +81,7 @@
   
       private boolean alive = true;
   
  -    // this is int he cacheAttr, shouldn't be used, remove
  +    // this is in the cacheAttr, shouldn't be used, remove
       final String cacheName;
   
       /**
  @@ -984,7 +986,7 @@
       }
   
       /**
  -     *  Gets the size attribute of the Cache object
  +     *  Gets the size attribute of the Cache object.  This return the number of elements,
not the byte size.
        *
        *@return    The size value
        */
  @@ -1066,7 +1068,7 @@
   
   
       /**
  -     *  Gets the cacheName attribute of the Cache object
  +     *  Gets the cacheName attribute of the Cache object.  This is also known as the region
name.
        *
        *@return    The cacheName value
        */
  
  
  
  1.19      +48 -7     jakarta-turbine-jcs/src/java/org/apache/jcs/access/CacheAccess.java
  
  Index: CacheAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/access/CacheAccess.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CacheAccess.java	12 May 2005 01:52:41 -0000	1.18
  +++ CacheAccess.java	18 May 2005 01:27:31 -0000	1.19
  @@ -36,14 +36,21 @@
   
   import org.apache.jcs.engine.control.CompositeCache;
   import org.apache.jcs.engine.control.CompositeCacheManager;
  +import org.apache.jcs.engine.stats.behavior.ICacheStats;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
   /**
  - * Class which provides interface for all access to the cache. An instance of
  - * this class is tied to a specific cache region. Static methods are provided to
  - * get such instances.
  + * This class provides an interface for all types of access to the cache. 
  + * <p>
  + * An instance of this class is tied to a specific cache region. Static methods 
  + * are provided to get such instances.
  + * <p>
  + * Using this class you can retrieve an item, the items wrapper, the element configuration,

  + * put an item in the cache, remove an item, and clear a region.
  + * <p>
  + * The JCS class is the prefered way to access these methods.
    *
    * @version $Id$
    */
  @@ -199,6 +206,26 @@
       }
   
       /**
  +     * This method returns the ICacheElement wrapper which provides access to 
  +     * element info and other attributes.  
  +     * <p>
  +     * This returns a reference to the wrapper.  Any modifications will
  +     * be reflected in the cache.  No defensive copy is made.
  +     * <p>
  +     * This method is most useful if you want to determine things such as the
  +     * how long the element has been in the cache.
  +     * <p>
  +     * The last access time in teh ElementAttributes should be current.
  +     *
  +     * @param name Key the object is stored as
  +     * @return The ICacheElement if the object is found or null
  +     */
  +    public ICacheElement getCacheElement( Object name )
  +    {
  +        return this.cacheControl.get( ( Serializable ) name );
  +    }
  +    
  +    /**
        * Place a new object in the cache, associated with key name. If there is
        * currently an object associated with name in the region an
        * ObjectExistsException is thrown. Names are scoped to a region so they
  @@ -232,7 +259,6 @@
           throws CacheException
       {
           // Call put with a copy of the contained caches default attributes.
  -
           put( name,
                obj,
                this.cacheControl.getElementAttributes().copy() );
  @@ -256,7 +282,6 @@
   
           // Create the element and update. This may throw an IOException which
           // should be wrapped by cache access.
  -
           try
           {
               CacheElement ce = new CacheElement( this.cacheControl.getCacheName(),
  @@ -356,6 +381,8 @@
       /**
        * If there are any auxiliary caches associated with this cache, save all
        * objects to them.
  +     * <p>
  +     * This is mainly a testing method.  Dispose should do what you want on shutdown in
a safer manner.
        */
       public void save()
       {
  @@ -445,6 +472,18 @@
       }
   
       /**
  +     * This returns the ICacheStats object with information on this region and its auxiliaries.
  +     * <p>
  +     * This data can be formatted as needed.
  +     * 
  +     * @return ICacheStats
  +     */
  +    public ICacheStats getStatistics()
  +    {
  +    	return this.cacheControl.getStatistics();
  +    }
  +    
  +    /**
        * 
        * @return A String version of the stats.  
        */     
  @@ -454,7 +493,9 @@
   
       /**
        * Dispose this region. Flushes objects to and closes auxiliary caches.
  -     * This is a shutdown command.  To simply remove all elements from the region
  +     * This is a shutdown command! 
  +     * <p>
  +     * To simply remove all elements from the region
        * use clear().
        */
       public void dispose()
  
  
  
  1.1                  jakarta-turbine-jcs/tempbuild/jcs-1.2.6.jar
  
  	<<Binary file>>
  
  
  1.2       +3 -2      jakarta-turbine-jcs/src/java/org/apache/jcs/engine/stats/behavior/ICacheStats.java
  
  Index: ICacheStats.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/stats/behavior/ICacheStats.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ICacheStats.java	6 Jan 2005 01:18:27 -0000	1.1
  +++ ICacheStats.java	18 May 2005 01:27:31 -0000	1.2
  @@ -17,7 +17,7 @@
    */
   
   /**
  - * This holds stat information on a region.
  + * This holds stat information on a region.  It contains both auxiliary and core stats.
    * 
    * @author aaronsm
    *
  @@ -26,8 +26,9 @@
   
   	
   	/**
  +	 * Stats are for a region, though auxiliary data may be for more.
   	 * 
  -	 * @return
  +	 * @return The region name
   	 */
   	public abstract String getRegionName();
   	
  
  
  

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


Mime
View raw message