cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Created: The CachingURICoplet
Date Mon, 15 Aug 2005 13:24:14 GMT
A new document has been created.

http://cocoon.zones.apache.org/daisy/documentation/663.html

Document ID: 663
Branch: main
Language: default
Name: The CachingURICoplet
Document Type: Document
Created: 8/15/05 1:23:58 PM
Creator (owner): Helma
State: publish

Parts
=====

Content
-------
Mime type: text/xml
Size: 3540 bytes
Content:
<html>
<body>

<p>The CachingURICoplet is an extension of the URICoplet (see previous chapter)
providing caching of the coplet content. Usually the user of a portal only
interacts with one single coplet at a time. As the interaction redraws the whole
portal page with several coplets, all coplets are asked to give their content.
In many situations this is not wanted. For example if the coplet contains a form
or has a state, asking the coplet to give its content although the user has not
submitted the form, might result in unwanted responses.</p>

<p>Therefore the CachingURICoplet caches the content of a coplet in the session
of the user. All further requests are served from the cache until the user
interacts with exactly this coplet. In this case the cache is cleared, the
coplet is invoked again and the new content is cached for further requests.</p>

<p>If you want to disable the caching, you can specify the boolean attribute
<em>cache-enabled</em> with the value <em>false</em> in the coplet
data
configuration.</p>

<p>You can also programmatically turn off caching for a coplet for a single
request by setting the attribute <em>doNotCache</em> with any value on the
coplet instance data. For example if you want to set this from flow:</p>

<pre>     ...
       var coplet = GET_THE_COPLET_INSTANCE_DATA;
       coplet.setAttribute("doNotCache", "1");
     ...
     </pre>

<p>By default the caching uri adapter ignores sizing events for clearing the
cache. This ensures that minimizing a coplet does not clear the cache. However,
if you want to disable the cache on a sizing event you can turn this on in the
configuration for a coplet data:</p>

<pre>...
&lt;coplet-data id="Portal-Demo" name="standard"&gt;
   &lt;title&gt;Introduction&lt;/title&gt;
   &lt;coplet-base-data&gt;CachingURICoplet&lt;/coplet-base-data&gt;
   &lt;attribute&gt;
      &lt;name&gt;uri&lt;/name&gt;
      &lt;value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
         cocoon:/coplets/docs/portal-demo.html
      &lt;/value&gt;
   &lt;/attribute&gt;
   &lt;attribute&gt;
      &lt;name&gt;ignore-sizing-events&lt;/name&gt;
      &lt;value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;false&lt;/value&gt;
   &lt;/attribute&gt;
&lt;/coplet-data&gt;
...
   </pre>

<h2>Global Caching</h2>

<p>The default caching mechanism caches the contents in the user session. If you
want to use a global cache across all users, you can turn this on with an
attribute on the coplet data configuration:</p>

<pre>...
&lt;coplet-data id="Portal-Demo" name="standard"&gt;
   &lt;title&gt;Introduction&lt;/title&gt;
   &lt;coplet-base-data&gt;CachingURICoplet&lt;/coplet-base-data&gt;
   &lt;attribute&gt;
     &lt;name&gt;uri&lt;/name&gt;
     &lt;value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
         cocoon:/coplets/docs/portal-demo.html
     &lt;/value&gt;
   &lt;/attribute&gt;
   &lt;attribute&gt;
     &lt;name&gt;cache-global&lt;/name&gt;
     &lt;value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;true&lt;/value&gt;
   &lt;/attribute&gt;
&lt;/coplet-data&gt;
...
     </pre>

<p>By using the boolean <em>cache-global</em> attribute with the value
<em>true</em> the contents of the coplet is cached in the usual Cocoon cache
making it available to all users.</p>

<p>The global cache is useful for static content that is the same for all users.
</p>

</body>
</html>

Collections
===========
The document belongs to the following collections: documentation

Mime
View raw message