cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/caching DeltaTimeCacheValidity.java
Date Sat, 02 Feb 2002 04:00:26 GMT
vgritsenko    02/02/01 20:00:26

  Modified:    src/java/org/apache/cocoon/caching
                        DeltaTimeCacheValidity.java
  Log:
  make possible second-resolution delays
  
  Revision  Changes    Path
  1.2       +14 -5     xml-cocoon2/src/java/org/apache/cocoon/caching/DeltaTimeCacheValidity.java
  
  Index: DeltaTimeCacheValidity.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/DeltaTimeCacheValidity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeltaTimeCacheValidity.java	3 Jan 2002 12:31:08 -0000	1.1
  +++ DeltaTimeCacheValidity.java	2 Feb 2002 04:00:26 -0000	1.2
  @@ -11,21 +11,31 @@
   import java.lang.Math;
   
   /**
  - * A validation object that remains valid for a specified amount of time (minutes).
  + * A validation object that remains valid for a specified amount of time.
    *
    * @author Michael Homeijer
    */
  -
   public final class DeltaTimeCacheValidity implements CacheValidity {
   
       private long cachedDateTime;  // Holds the store-time in miliseconds
       private long timeInCache;     // maximum time allowed in cache in minutes
   
  -    public DeltaTimeCacheValidity(long timeInCache) {
  +    /**
  +     * Creates validity object with timeout in minutes.
  +     */
  +    public DeltaTimeCacheValidity(long minutes) {
           this.cachedDateTime = System.currentTimeMillis();
           this.timeInCache = timeInCache * 60000;
       }
   
  +    /**
  +     * Creates validity object with timeout in minutes, seconds.
  +     */
  +    public DeltaTimeCacheValidity(long minutes, long seconds) {
  +        this.cachedDateTime = System.currentTimeMillis();
  +        this.timeInCache = minutes * 60000 + seconds * 1000;
  +    }
  +
       public boolean isValid(CacheValidity validity) {
           if (validity instanceof DeltaTimeCacheValidity) {
               return Math.abs((((DeltaTimeCacheValidity)validity).getCachedDateTime() - this.cachedDateTime))
< this.timeInCache;
  @@ -38,7 +48,6 @@
       }
   
       public String toString() {
  -        return "DeltaTimeCacheValidity: " + this.cachedDateTime + "(+" + this.timeInCache
+ "min)";
  +        return "DeltaTimeCacheValidity: " + this.cachedDateTime + "(+" + this.timeInCache
+ "ms)";
       }
  -
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message