[jboss-user] [JBoss Seam] - Re: How to set expiry time for s:cache?
satellite
do-not-reply at jboss.com
Sun Nov 25 04:27:45 EST 2007
I'm using this treecache.xml with success:
<?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="org.jboss.cache.TreeCache"
| name="jboss.cache:service=TreeCache">
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
|
| <!-- Configure the TransactionManager -->
| <attribute name="TransactionManagerLookupClass">
| org.jboss.cache.JBossTransactionManagerLookup
| </attribute>
|
| <!-- Specific eviction policy configurations. -->
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
|
| <!-- Cache wide default -->
| <region name="/_default_"
| policyClass="org.jboss.cache.eviction.LRUPolicy">
| <!-- This is the maximum number of nodes allowed in this region. -->
| <!-- 0 denotes no limit. -->
| <attribute name="maxNodes">0</attribute>
|
| <!-- The amount of time a node is not written to or read (in seconds) before the node is swept away. -->
| <!-- 0 denotes no limit. -->
| <attribute name="timeToLiveSeconds">0</attribute>
|
| <!-- Lifespan of a node (in seconds) regardless of idle time before the node is swept away. -->
| <!-- 0 denotes no limit. -->
| <attribute name="maxAgeSeconds">0</attribute>
| </region>
|
| <region name="/5sec"
| policyClass="org.jboss.cache.eviction.LRUPolicy">
| <attribute name="maxNodes">0</attribute>
| <attribute name="timeToLiveSeconds">0</attribute>
| <attribute name="maxAgeSeconds">5</attribute>
| </region>
| </config>
| </attribute>
| </mbean>
| </server>
|
Code for testing:
| <table border="1">
| <tr>
| <td><b>Short term cache ('/5sec'):</b></td>
| <td>
| <s:cache region="/5sec" key="now" enabled="true">
| <h:outputText value="#{form.info.now()}" />
| </s:cache>
| </td>
| </tr>
| <tr>
| <td><b>Long term cache ('/forever'):</b></td>
| <td>
| <s:cache region="/forever" key="now" enabled="true">
| <h:outputText value="#{form.info.now()}" />
| </s:cache>
| </td>
| </tr>
| </table>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107563#4107563
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107563
More information about the jboss-user
mailing list