cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: Event Caching
Date Thu, 05 Jan 2006 12:40:08 GMT
A document has been updated:

Document ID: 794
Branch: main
Language: default
Name: Event Caching (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 1/5/06 12:39:53 PM
Updated by: Max Pfingsthorn

A new version has been created, state: publish

This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 2776 bytes (previous version: 132 bytes)
Content diff:
--- <p>This document describes the event caching block and getting it to work with
--- the webdav block.</p>
+++ <h2>Introduction</h2>
+++ <p>Event caching is a very efficient way to do adaptive caching. Instead of
+++ using things like expire times and timestamps, an event sent by the source of
+++ the cached content to invalidate it in the cache. A database trigger or some
+++ other notification mechanism could initiate this event. This is of course much
+++ more efficient and care free than recreating the cached content every x
+++ seconds/minutes/hours.</p>
+++ <h2>Implementation details</h2>
+++ <p>Each cache key gets assigned a validity by the current caching mechanism.
+++ This validity object decides if this cached content is still valid. The
+++ EventValidity used for event caching will always say a cached resource is valid,
+++ and provide a hook for this resource to be removed from the cache when a certain
+++ event arrives.</p>
+++ <h2>Configuration</h2>
+++ <p>You need to configure the EventAware cache implementation in cocoon.xconf:
+++ </p>
+++ <pre>&lt;component role="org.apache.cocoon.caching.Cache/EventAware" class="org.apache.cocoon.caching.impl.EventAwareCacheImpl"/&gt;
+++ </pre>
+++ <p>and also the EventRegistry, a map between events and cache keys:</p>
+++ <pre>&lt;component role="org.apache.cocoon.caching.EventRegistry" class="org.apache.cocoon.caching.impl.StoreEventRegistryImpl"/&gt;
+++ </pre>
+++ <p>Then, include the event caching pipeline in your sitemap:</p>
+++ <pre>&lt;map:components&gt;
+++   &lt;map:pipes default="caching"&gt;
+++     &lt;map:pipe name="eventcaching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"&gt;
+++       &lt;parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"/&gt;
+++     &lt;/map:pipe&gt;
+++   &lt;/map:pipes&gt;
+++ &lt;/map:components&gt;
+++ </pre>
+++ <p>From then on, you can use the "eventcaching" pipeline in your sitemap:</p>
+++ <pre>&lt;map:pipelines&gt;
+++   &lt;map:pipeline type="eventcaching"&gt;
+++     &lt;map:match pattern="something-eventcached"&gt;
+++       ...
+++     &lt;/map:match&gt;
+++   &lt;/map:pipeline&gt;
+++ &lt;/map:pipelines&gt;
+++ </pre>
+++ <p>Then you also need a way to get invalidation events, otherwise your content
+++ always stays in the cache. There are some examples how to do that in the samples
+++ of the eventcache block. One commonly used way is via JMS. For that either use
+++ the given <tt>JMSEventMessageListener</tt> or subclass it to do your own message
+++ handling. Then configure it in cocoon.xconf:</p>
+++ <pre>&lt;component class="org.apache.cocoon.caching.impl.JMSEventMessageListener"

+++       role="org.apache.cocoon.caching.impl.JMSEventMessageListener" logger="core.jms"&gt;
+++   &lt;parameter name="connection" value="local-topics"/&gt;
+++   &lt;parameter name="topic" value="topic1"/&gt;
+++ &lt;/component&gt;
+++ </pre>
+++ <p>You can configure your own connection (done by the JMS block) and topic name
+++ to listen to.</p>

no changes

no changes

Custom Fields
no changes

no changes

View raw message