[jboss-user] [JBossCache] - Eviction Policy and configuration issues

Spievak do-not-reply at jboss.com
Wed Aug 2 01:33:29 EDT 2006


Hi, i´m having some problems with cache eviction. I have used the TreeCache implementation with the following configuration:


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <server>
  | 
  |     <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
  | 
  |     <mbean code="org.jboss.cache.TreeCache"     name="jboss.cache:service=TreeCache">
  | 
  |         <depends>jboss:service=Naming</depends>
  |         <depends>jboss:service=TransactionManager</depends>
  | 
  |         <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
  |         <attribute name="CacheMode">LOCAL</attribute>
  | 		
  | 		<!-- Name of the eviction policy class. -->
  |         <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
  |         <!-- Specific eviction policy configurations. This is LRU -->
  |         <attribute name="EvictionPolicyConfig">
  |            <config>
  |               <attribute name="wakeUpIntervalSeconds">5</attribute>
  |               <!-- Cache wide default -->
  |               <region name="/_default_">
  |                   <attribute name="maxNodes">1000</attribute>
  |                   <attribute name="timeToLiveSeconds">10</attribute>
  |               </region>
  |               <region name="/teste">
  |                   <attribute name="maxNodes">1000</attribute>
  |                   <attribute name="timeToLiveSeconds">10</attribute>
  |               </region>
  |            </config>
  |         </attribute>
  |     </mbean>
  | </server>
  | 

I was expecting that with this config nodes with live greater than 10 seconds be collected by LRU policy and the be throwed away since there is not CacheLoader assigned.
But the node remains in cache after the assigned time.

the code used for testing:

  | cache.put(new Fqn(new Object[] { "/test", 1 }), "item", "1");
  | Thread.currentThread().sleep(30000);
  | System.out.println(cache.get(new Fqn(new Object[] { "/test", 1}), "item"));
  | 

Since the node was not removed i try removing it in code, as:

cache.put(new Fqn(new Object[] { "/test", 1 }), "item", "1");
  | cache.remove(new Fqn(new Object[] { "/teste", 1 }));
  | Thread.currentThread().sleep(30000);
  | System.out.println(cache.get(new Fqn(new Object[] { "/test", 1}), "item"));

And again the node remains in cache.

Any suggestions ???

Thanks.






View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962354#3962354

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962354




More information about the jboss-user mailing list