cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpfingsth...@apache.org
Subject svn commit: r386365 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java
Date Thu, 16 Mar 2006 16:01:04 GMT
Author: mpfingsthorn
Date: Thu Mar 16 08:01:02 2006
New Revision: 386365

URL: http://svn.apache.org/viewcvs?rev=386365&view=rev
Log:
Cache performance enhancement. Now, while generating the cached response, we don't bother
to set up the underlying pipeline anymore.
This significantly increases performance for complex pipelines. Preserves previous functionality
in respect to cache key identity.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/ExpiresCachingProcessingPipeline.java?rev=386365&r1=386364&r2=386365&view=diff
==============================================================================
--- 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
Thu Mar 16 08:01:02 2006
@@ -207,6 +207,13 @@
      * Prepare the pipeline
      */
     protected void preparePipeline(Environment environment)
+    throws ProcessingException { 
+    	// prepare pipeline only if we don't have a cached response yet
+        if( this.cachedResponse == null )
+            super.preparePipeline(environment);
+    }
+
+    protected void setupPipeline(Environment environment)
     throws ProcessingException {
         // get the key and the expires info
         // we must do this before we call super.preparePipeline,
@@ -230,9 +237,6 @@
             objectModel.remove(CACHE_EXPIRES_KEY);
         }
 
-        // prepare the pipeline
-        super.preparePipeline( environment );
-
         // and now prepare the caching information
         this.cacheKey = new IdentifierCacheKey(key,
                                            this.serializer == this.lastConsumer);
@@ -255,6 +259,11 @@
             Response res = ObjectModelHelper.getResponse(environment.getObjectModel());
             res.setDateHeader("Expires", System.currentTimeMillis() + (this.cacheExpires*1000));
             res.setHeader("Cache-Control", "max-age=" + this.cacheExpires + ", public");
+        }
+        
+        // only actually set up pipeline components when there was no cached response found
for the specified key
+        if(this.cachedResponse == null) {
+        	super.setupPipeline( environment );
         }
     }
 



Mime
View raw message