You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/02/02 14:29:01 UTC

svn commit: r502603 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/portal/java/org/apache/cocoon/portal/application/ src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java status.xml

Author: cziegeler
Date: Fri Feb  2 05:29:01 2007
New Revision: 502603

URL: http://svn.apache.org/viewvc?view=rev&rev=502603
Log:
Core: Exipres caching pipeline can now cache the content forever (by setting cache-expires
to a negative value).

Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/application/
Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java?view=diff&rev=502603&r1=502602&r2=502603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java Fri Feb  2 05:29:01 2007
@@ -34,6 +34,7 @@
 
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.ExpiresValidity;
+import org.apache.excalibur.source.impl.validity.NOPValidity;
 
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
@@ -47,6 +48,11 @@
  *   <parameter name="cache-expires" value="180"/> <!-- Expires in secondes -->
  * </map:pipe>
  *
+ * The cache-expires parameter controls the period of time for caching the content. A positive
+ * value is a value in seconds, a value of zero means no caching and a negative value means
+ * indefinite caching. In this case, you should use an external mechanism to invalidate the
+ * cache entry.
+ *
  * @since 2.1
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @version CVS $Id$
@@ -66,7 +72,7 @@
     /** The key used for caching */
     protected IdentifierCacheKey cacheKey;
 
-    /** The expires information */
+    /** The expires information. */
     protected long cacheExpires;
 
     /** Default value for expiration */
@@ -173,7 +179,7 @@
             // internal
             if ( this.cachedResponse == null) {
                 // if we cache, we need an xml serializer
-                if ( this.cacheExpires > 0) {
+                if ( this.cacheExpires != 0) {
                     try {
                         final XMLConsumer old = this.lastConsumer;
                         this.xmlSerializer = (XMLSerializer)this.manager.lookup( XMLSerializer.ROLE );
@@ -243,6 +249,8 @@
                                            this.serializer == this.lastConsumer);
         if ( this.cacheExpires > 0) {
             this.cacheValidity = new ExpiresValidity(this.cacheExpires*1000);
+        } else if ( this.cacheExpires < 0 ) {
+            this.cacheValidity = NOPValidity.SHARED_INSTANCE;
         }
         final boolean purge = this.parameters.getParameterAsBoolean("purge-cache", false);
 
@@ -263,7 +271,7 @@
         }
         
         // only actually set up pipeline components when there was no cached response found for the specified key
-        if(this.cachedResponse == null) {
+        if ( this.cachedResponse == null ) {
         	super.setupPipeline( environment );
         }
     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=502603&r1=502602&r2=502603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Fri Feb  2 05:29:01 2007
@@ -181,6 +181,10 @@
 
   <changes>
   <release version="2.1.11" date="TBD">
+    <action dev="CZ" type="add">
+      Core: Exipres caching pipeline can now cache the content forever (by setting cache-expires
+      to a negative value).
+    </action>
     <action dev="VG" type="add">
       Core: In store janitor, add an option to cleanup all stores on each janitor
       run. Default behavior is to cleanup one store at a time.