Hi,
I am trying to test out the expiration/timeout of objects in memory using JBoss
Cache. But it seems not working for me.
My test codes are simply trying to get the value of the object I put in the
tree every 5 sec.
try {
TreeCache tree = new TreeCache();
PropertyConfigurator config = new PropertyConfigurator();
config.configure(tree, "my-config.xml");
tree.startService();
tree.put("/test/1/", "5sec", "5 sec test");
int count = 0;
boolean run = true;
while (run) {
count++;
if (count==3) run = false;
String s = (String)tree.get("/fandango/1","5sec");
System.out.println("s: " + s);
Thread.sleep(5000);
}
tree.stopService();
} catch (Exception e) {
e.printStackTrace();
}
And in my-config.xml file I have:
org.jboss.cache.eviction.LRUPolicy
5
<!-- Cache wide default -->
5000
3
<!-- Maximum time an object is kept in cache regardless of idle time
-->
5
1000
2
3
So in theory, the 2nd time when the tree.get() the object, it should return
null because it's already expired. But my tests show otherwise.
Please advise,
Many thanks,
Hong
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3902094#3902094
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3902094
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user