jon         01/05/14 13:19:48

  Modified:    docs     code-standards.html
               src/java/org/apache/turbine/services/cache CachedObject.java
  Log:
  >> I needed to have non-expiring objects in the global cache. As far as
  I can
  >> see, you can do this with a RefreshableCachedObject which in turn
  >> will refresh itself forever. I added two constants to CachedObject
  to make
  >> this explicitly possible. Patch attached.
  >>
  >> Regards
  >> Henning
  
  <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.40      +1 -1      jakarta-turbine/docs/code-standards.html
  
  Index: code-standards.html
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/docs/code-standards.html,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- code-standards.html       2001/05/14 18:34:43     1.39
  +++ code-standards.html       2001/05/14 20:19:36     1.40
  @@ -309,7 +309,7 @@
       <tr>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
         <td bgcolor="#ffffff"><pre>
  -@version $Id: code-standards.html,v 1.39 2001/05/14 18:34:43 jon Exp $
  +@version $Id: code-standards.html,v 1.40 2001/05/14 20:19:36 jon Exp $
   </pre></td>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
       </tr>
  
  
  
  1.8       +15 -2     
jakarta-turbine/src/java/org/apache/turbine/services/cache/CachedObject.java
  
  Index: CachedObject.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/cache/CachedObject.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CachedObject.java 2001/05/05 15:26:54     1.7
  +++ CachedObject.java 2001/05/14 20:19:44     1.8
  @@ -62,11 +62,19 @@
    * time.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dave Bryson</a>
  - * @version $Id: CachedObject.java,v 1.7 2001/05/05 15:26:54 jvanzyl Exp $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Henning P. Schmiedehausen</a>
  + * @version $Id: CachedObject.java,v 1.8 2001/05/14 20:19:44 jon Exp $
    */
   public class CachedObject
       implements java.io.Serializable
   {
  +
  +    /** Cache the object with the Default TTL */
  +    public static final int DEFAULT = 0;
  +
  +    /** Do not expire the object */
  +    public static final int FOREVER = -1;
  +
       /** The object to be cached. */
       private Object contents = null;
   
  @@ -107,7 +115,7 @@
       public CachedObject(Object o,
                           long expires)
       {
  -        if ( expires == 0 )
  +        if ( expires == DEFAULT )
           {
               this.expires = defaultage;
           }
  @@ -174,6 +182,11 @@
        */
       public synchronized boolean isStale()
       {
  +        if(expires == FOREVER)
  +        {
  +            return false;
  +        }
  +
           setStale( (System.currentTimeMillis() - created) > expires );
           return getStale();
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to