[jboss-user] [JBossCache] - EvictionPolicyConfig and CacheLoaderConfiguration
sioux
do-not-reply at jboss.com
Tue May 29 12:16:04 EDT 2007
Hi,
I've been looking at eviction policies and have found that my CacheLoaderConfiguration config entry breaks my eviction policy.
e.g. this unit test (taken roughly from jboss src) -
public void testInUseEviction() throws Exception
| {
| long wakeupIntervalMillis_ = 3000;
| String rootStr = "/org/jboss/test/data/inuse/";
| Fqn fqn;
| for (int i = 0; i < 10; i++)
| {
| String str = rootStr + i;
| fqn = Fqn.fromString(str);
| tree.put(fqn, str, str);
| }
|
| Thread.sleep(wakeupIntervalMillis_ + 500);
| tree.getEvictionRegionManager().markNodeCurrentlyInUse(Fqn.fromString(rootStr + 5), 0);
|
| for (int i = 10; i < 15; i++)
| {
| String str = rootStr + i;
| fqn = Fqn.fromString(str);
| tree.put(fqn, str, str);
| }
|
| Thread.sleep(wakeupIntervalMillis_ + 500);
|
| for (int i = 0; i < 5; i++)
| {
| //fails here
| assertNull(tree.get(Fqn.fromString(rootStr + i)));
| }
| }
works with this config:
<server>
|
| <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
| <!-- ==================================================================== -->
| <!-- Defines TreeCache configuration -->
| <!-- ==================================================================== -->
|
| <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">
| <attribute name="CacheMode">LOCAL</attribute>
|
|
| <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
| <region name="/_default_">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToLiveSeconds">1000</attribute>
| </region>
| <region name="/org/jboss/data">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToLiveSeconds">1000</attribute>
| </region>
| <region name="/org/jboss/test/data">
| <attribute name="maxNodes">5</attribute>
| <attribute name="timeToLiveSeconds">4</attribute>
| </region>
| </config>
| </attribute>
|
|
| </mbean>
| </server>
but not when I include this section:
<attribute name="CacheLoaderConfiguration">
| <config>
| <passivation>false</passivation>
| <preload>/</preload>
| <shared>false</shared>
| <cacheloader>
| <class>org.jboss.cache.loader.FileCacheLoader</class>
|
| <properties>location=/tmp/testcachestore</properties>
|
| <async>false</async>
| <fetchPersistentState>true</fetchPersistentState>
| <ignoreModifications>false</ignoreModifications>
| <purgeOnStartup>true</purgeOnStartup>
| </cacheloader>
|
| </config>
| </attribute>
Is there a way for me to use both features on a single cache? (My goal is to back up the cache to a file store but also to replace all data items over a 24 hour period for which I was considering a custom eviction policy or lazy loading following eviction).
Thanks for any suggestions or help understanding this.
Sioux
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049425#4049425
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049425
More information about the jboss-user
mailing list