Skip to content

Commit

Permalink
ExpiresValidity sample
Browse files Browse the repository at this point in the history
  • Loading branch information
lgawron committed Sep 18, 2006
1 parent 2cf1507 commit 5b0ae4c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</p>

<p>
Next sample: none.<br/>
Next sample: <a href="../view/caching4">Setting other validities</a>.<br/>
Go <a href="../">Back</a> to Cocoon Template samples.
</p>
</content>
Expand Down
28 changes: 28 additions & 0 deletions cocoon-template-sample/src/main/resources/COB-INF/view/caching4.jx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" jx:cache-key="abc" jx:cache-validity="${Packages.org.apache.excalibur.source.impl.validity.ExpiresValidity(10000)}">
<title>JX Caching</title>
<content>
<p>
This content has been generated at <jx:formatDate value="${java.util.Calendar.getInstance().getTime()}" pattern="yyyy-MM-dd HH:mm:ss"/><br/>
</p>
<p>
Caching configuration is <b>jx:cache-key=&quot;abc&quot;
jx:cache-validity=&quot;$ {Packages.org.apache.excalibur.source.impl.validity.ExpiresValidity(10000)}&quot;</b>
</p>

<p>
This means that once the content is generated it expires after 10 seconds.<br/>
The cache key is static so there will only be one instance of cached document.<br/>
You may of course mix various cache key generation strategies with different validities.<br/>
</p>

<p>
You may try to <a href="">reload the page</a> and see if generation date changes.<br/>
You may try to <a href="?foo=bar">define additional request parameters</a> to see that it does not change a thing.
</p>

<p>
Next sample: none.<br/>
Go <a href="../">back</a> to Cocoon Template samples.
</p>
</content>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<group name="Caching">
<sample name="Static caching" href="view/caching1">Static caching</sample>
<sample name="Request parameter based caching" href="view/caching2">Request parameter based caching</sample>
<sample name="Request parameter based caching" href="view/caching3">Caching with all request parameters</sample>
<sample name="Caching with all request parameters" href="view/caching3">Caching with all request parameters</sample>
<sample name="Using ExpiresValidity" href="view/caching3">Using ExpiresValidity</sample>
</group>
</samples>

0 comments on commit 5b0ae4c

Please sign in to comment.