Eviction policy is what you are looking for, I think.
JBossCache provides a default LRU implementation. the "time-to-live" is not set per object you insert in the cache, but per region.
Check eviction policy in JBossCache documentation.
sorry, should have been clearer, i was asking if a time-based eviction policy would be added. I've looked thru the api and I can't see any references to the time that an FQN is added, so I suppose it would have to be maintained separately, ie listen for the creation/update of a node and log the time. Then a timertask could revise a region and look at the time that the node was added, compare it to the ttl on the node, and evict the node if necessary.
The only problem is that this requires adding the ttl param to the put() method, and maintaining the time that that node was created. As I said before, we have coded this internally, but it depends on other libraries (namely quartz and spring) as the timer. We've extended treeCache to add the params needed and then set up quartz using spring. Do other people see the value in this, and would people be happy with those dependencies?
The benefit of having ttl on nodes is that you can achieve the same functionality as oscache in the web tier, using filters and taglibs with timeouts which is really useful.
I think this can be all implemented as an eviction policy.
The only thing that cannot be implemented using the eviciton policy is the ttl per node, unless you come up with a specific nming convention for the node and provide the ttl in some other ways (such as through the configuration of your eviction policy).
Other option could be to always add a cached object in your node which will be the ttl. Your evcition policy could then look at this object to determine when the node must be evicted.
Our design of eviction policy is not based on per-node basis. Rather it is per-region.
Nonetheless to create *roughly* what you want to achieve, it still can be done through the current eviction policy framework.
Couple things need to happen though:
1. Region parameters will need to be configure dynamically. So you work with a Region still. Now it is still through configured thorugh xml. But we do have plan to add it later. See http://jira.jboss.com/jira/browse/JBCACHE?report=com.atlassian.jira.plugin.system.project:roadmap-panel for the roadmap.
2. Write an eviction policy that ignores any node modification event and evict based on time. If you want to contribute this piece of code, let me know.