Geoff Howard wrote:

Geoff Howard wrote:

Joerg Heinicke wrote:


http://127.0.0.1:8888/samples/eventcache/
Does not work. Neither "uncache with action" (nothing happens) nor
"uncache with flow" (results in exception). This has nothing to do with
the switch from ComposerGenerator to SerializableGenerator I did a few
days ago. I didn't work before too. Must something be done before using
eventcache? As above the first link opens unnecessary (?) new windows.


Hmmm. Well, you have to include the block in the build but that should be it. I haven't checked in the last week or so but this was always working to my knowledge. I'll check into it.


OK, I've discovered this was broken by a commit by [insert Release Manager's name here :P] before the 2.1.1 release. The EventAware Cache was meant to be a Decorator around the normal CacheImpl and so was using its default role. Carsten added configurable caches to map:pipe and modified this samples' sitemap but in the refactoring neither the sample flow nor the sample action which looked up the component in the sample was modified to use the new role. I thought I had checked this after that point but apparently not as this would have been hard to miss.

I'm trying to fix it now but it doesn't seem that the cached responses are winding up in the configured cache (they're in the regular cache and aren't getting cleared). If I get it working soon I'll commit it as a bug fix. I don't think this can possibly affect anything else but if it does, just revert the change and blame [insert random committer's name here].

No luck so far. After fixing the roles as mentioned above, I find that my EventAwareCacheImpl is indeed now instantiated and returned to my other components. I see the log entry:


DEBUG (2003-09-30) 23:09.39:682 [sitemap] (/samples/eventcache/demo) PoolThread-4/BaseCachingProcessingPipeline: Using cache org.apache.cocoon.caching.Cache/EventAware

which should mean that the pipeline is using that component but I don't see the log events during EventAwareCacheImpl.store() only:
DEBUG (2003-09-30) 23:09.53:071 [core.manager] (/samples/eventcache/demo) PoolThread-4/CacheImpl: Caching new response for PK_G-serverpages-file:/D:/workspace/cocoon-2.1/build/webapp/samples/eventcache/eventcache.xsp-one_T-xslt-file:/D:/workspace/cocoon-2.1/build/webapp/samples/stylesheets/dynamic-page2html.xsl;sitemapURI=demo;file=eventcache.xsp;servletPath=/samples/eventcache/demo;remove=demo;contextPath=_S-html-1
DEBUG (2003-09-30) 23:09.53:071 [core.store.transient] (/samples/eventcache/demo) PoolThread-4/MRUMemoryStore: Holding object in memory:
DEBUG (2003-09-30) 23:09.53:071 [core.store.transient] (/samples/eventcache/demo) PoolThread-4/MRUMemoryStore: key:


which tells me that for some reason the Pipeline is not actually using the configured Cache. Attached is the diff of what I've got now if anyone wants to try it out.

Geoff
Index: java/org/apache/cocoon/acting/CacheEventAction.java
===================================================================
RCS file: 
/home/cvs/cocoon-2.1/src/blocks/eventcache/java/org/apache/cocoon/acting/CacheEventAction.java,v
retrieving revision 1.2
diff -u -r1.2 CacheEventAction.java
--- java/org/apache/cocoon/acting/CacheEventAction.java 4 Aug 2003 03:06:30 -0000      
 1.2
+++ java/org/apache/cocoon/acting/CacheEventAction.java 1 Oct 2003 03:30:54 -0000
@@ -62,9 +62,6 @@
 import org.apache.cocoon.environment.SourceResolver;
 
 /**
- * Very experimental start at external cache invalidation.
- * Warning - API very unstable.  Do not use!  
- * 
  * Simple action to cause notification of a NamedEvent to an EventAwareCacheImpl.
  * The event name is taken from a sitemap parameter named "event".
  * 
@@ -88,7 +85,7 @@
                     String src,
                     Parameters par
     ) throws Exception {
-        Cache cache = (Cache)this.manager.lookup(Cache.ROLE);
+        Cache cache = (Cache)this.manager.lookup(Cache.ROLE + "/EventAware");
         if (cache instanceof EventAwareCacheImpl) {
             String eventName = par.getParameter("event");
             if (getLogger().isDebugEnabled()) {
Index: java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
===================================================================
RCS file: 
/home/cvs/cocoon-2.1/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java,v
retrieving revision 1.5
diff -u -r1.5 EventAwareCacheImpl.java
--- java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java        5 Sep 2003 
04:02:51 -0000       1.5
+++ java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java        1 Oct 2003 
03:30:54 -0000
@@ -100,6 +100,9 @@
             SourceValidity val = validities[i];
                        examineValidity(val, key);
         }
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Putting key into Store: " + key);
+        }
                super.store(key, response);
        }
 
Index: samples/event.js
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/eventcache/samples/event.js,v
retrieving revision 1.2
diff -u -r1.2 event.js
--- samples/event.js    21 Jul 2003 01:54:37 -0000      1.2
+++ samples/event.js    1 Oct 2003 03:30:54 -0000
@@ -1,4 +1,4 @@
-var role = Packages.org.apache.cocoon.caching.Cache.ROLE;
+var role = Packages.org.apache.cocoon.caching.Cache.ROLE + "/EventAware";
 
 function cacheEvent() {
        var cache = cocoon.getComponent(role);
Index: samples/eventcache.xsp
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/eventcache/samples/eventcache.xsp,v
retrieving revision 1.1
diff -u -r1.1 eventcache.xsp
--- samples/eventcache.xsp      14 Jul 2003 02:50:45 -0000      1.1
+++ samples/eventcache.xsp      1 Oct 2003 03:30:54 -0000
@@ -3,7 +3,7 @@
 <!--
     XSP event-based cache sample.
 
-    $Id$
+    Cvs $Id$
  -->
 
 
@@ -100,10 +100,10 @@
                </para>
         <para>Test links:
             <ul>
-                <li><a target="_new" href="?pageKey=one">pageKey=one</a> 
+                <li><a href="?pageKey=one">pageKey=one</a> 
                        (<a href="action?pageKey=one&amp;event=one">uncache with 
action</a>) 
                        (<a href="flow?pageKey=one&amp;event=one">uncache with 
flow</a>)</li>
-                <li><a target="_new" href="?pageKey=two">pageKey=two</a>
+                <li><a href="?pageKey=two">pageKey=two</a>
                        (<a href="action?pageKey=two&amp;event=two">uncache with 
action</a>) 
                        (<a href="flow?pageKey=two&amp;event=two">uncache with 
flow</a>)</li>
             </ul>

Reply via email to