Thanks for the comment. Currently, "Region" is supported only within LRUPolicy right now (although we will expand that in the next release).
So you don't use Region and RegionManager directly.
Hope this answer your question,
I understand, and thank you for the swiftness of your reply.
My question then becomes is there a way to dynamically set the timeouts of nodes without using the xml and PropertyConfigurator? Basically a function like this:
int timeOutInSeconds = 60;
No, we don't support dynamic configuration of eviction policy per node.
If you want to customize the static node behavior, then you can define "Region" to be a finer granualirty. Will this not meet your need?
I see, so let's say I wanted to use the LRUAlgorithm on node "/a" of my cache to give it a 10 second timeout. In such a case I would declare a regionManager to have my LRUPolicy, grab a region from the manager with a node "/a" and the LRUAlgorithm and set the region timeout. As follows:
cache=new TreeCache(group_name, props, 3000);
// .. instantiate cache code...
LRUAlgorithm algo = new LRUAlgorithm();
LRUPolicy policy = new LRUPolicy();
RegionManager regionManager = new RegionManager(policy);
Region region = regionManager.createRegion("/a", algo);
My question is then how to tie this back into the cache. The treecache has cache.setEvictionPolicyClass(String policy_class), but then how does it know about the region?
Thanks a lot for your patience, and any sample code that could be provided would be greatly appreciated.
No, you can't do it programmatically is what I am saying. But you can do it inside the config xml file, e.g., you specify a region "/a" in there and the TimeToIdleSeconds parameters.
Can't I get the get the region from the RegionManager given the FQN string and then for that region set the idle time ( Assuming that there is only one node in that region)
What you mentioned is doable but not possible right now since RegionManager is not a singleton so user can't obtain the reference directly to mainupulate the eviction policy config directly. But I may consider to provide it in the next major release.