You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2006/01/05 13:40:08 UTC
[DAISY] Updated: Event Caching
A document has been updated:
http://cocoon.zones.apache.org/daisy/documentation/794.html
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
Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name: (unchanged)
Size: 2776 bytes (previous version: 132 bytes)
Content diff:
<html>
<body>
--- <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><component role="org.apache.cocoon.caching.Cache/EventAware" class="org.apache.cocoon.caching.impl.EventAwareCacheImpl"/>
+++ </pre>
+++
+++ <p>and also the EventRegistry, a map between events and cache keys:</p>
+++
+++ <pre><component role="org.apache.cocoon.caching.EventRegistry" class="org.apache.cocoon.caching.impl.StoreEventRegistryImpl"/>
+++ </pre>
+++
+++ <p>Then, include the event caching pipeline in your sitemap:</p>
+++
+++ <pre><map:components>
+++ <map:pipes default="caching">
+++ <map:pipe name="eventcaching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
+++ <parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"/>
+++ </map:pipe>
+++ </map:pipes>
+++ </map:components>
+++ </pre>
+++
+++ <p>From then on, you can use the "eventcaching" pipeline in your sitemap:</p>
+++
+++ <pre><map:pipelines>
+++ <map:pipeline type="eventcaching">
+++ <map:match pattern="something-eventcached">
+++ ...
+++ </map:match>
+++ </map:pipeline>
+++ </map:pipelines>
+++ </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><component class="org.apache.cocoon.caching.impl.JMSEventMessageListener"
+++ role="org.apache.cocoon.caching.impl.JMSEventMessageListener" logger="core.jms">
+++ <parameter name="connection" value="local-topics"/>
+++ <parameter name="topic" value="topic1"/>
+++ </component>
+++ </pre>
+++
+++ <p>You can configure your own connection (done by the JMS block) and topic name
+++ to listen to.</p>
+++
</body>
</html>
Fields
======
no changes
Links
=====
no changes
Custom Fields
=============
no changes
Collections
===========
no changes