I should say, I want to have expiration per Node like you can per entry in a regular infinispan cache. thanks.
I don't think that's currently possible actually, but you can set expiration time globally.
Do you really need a tree structure for what you want to store? Why do you need it?
If possible, i'd stick with Map API.
Its an HTTP cache of URLs that have different representation media types that all may have different cache expirations. When a PUT/POST/DELETE request comes in for that URL, I want to invalidate all cached representations of that URL. Or, if I want to delete all cached media types for a specific URL.
At first glance, i'd take URL+media-type as key and then have each cache entry have a different expiration time. There're put() calls that take user defined expiration values.
The tricky thing is, how do you invalidate all cached representations of that URL?
One option is to have two caches:
URL+media-type -> whatever... (each put with a different expiration...)
URL-> collection of [URL+media-type] that represent the keyed URL
When you invalidate a URL, you go through the collection and remove then from cache1.
This is an option that does not require tree/ structure and neither indexing/map-reduce.
Other options include having Cache 1 only, and then looping through cache to find all URLs that match and invalidate those. If the cache is local, this can be done with keySet(). If the cache is clustered, you can do map/reduce to invalidate in all nodes of cluster.
Yup, that's exactly what I had implemented, 2 caches, URL+media-type -> byte URL->collection I don't think I have any concurrency issues, but would have been cool if TreeCache supported per-node expiration. The old JBoss Cache did.
Fair point but to be honest, tree module in Infinispan is more of a legacy module to help people migrate of JBoss Cache. We do not plan to do any major work on it. Feel free to request it in https://issues.jboss.org/browse/ISPN though
Btw, you can still use atomic maps to group data under a single key. We don't have much docu on that, except for http://docs.jboss.org/infinispan/5.2/apidocs/org/infinispan/atomic/AtomicMap.html but I'm gonna try to get that sorted.