-
1. Re: Expiration for TreeCache node?
bill.burke Aug 23, 2012 3:53 PM (in response to bill.burke)I should say, I want to have expiration per Node like you can per entry in a regular infinispan cache. thanks.
-
2. Re: Expiration for TreeCache node?
galder.zamarreno Aug 27, 2012 5:09 AM (in response to bill.burke)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.
-
3. Re: Expiration for TreeCache node?
bill.burke Aug 27, 2012 4:05 PM (in response to galder.zamarreno)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.
-
4. Re: Expiration for TreeCache node?
galder.zamarreno Aug 30, 2012 5:08 AM (in response to bill.burke)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:
Cache 1:
URL+media-type -> whatever... (each put with a different expiration...)
Cache 2:
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.
-
5. Re: Expiration for TreeCache node?
bill.burke Aug 30, 2012 10:10 AM (in response to galder.zamarreno)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.
-
6. Re: Expiration for TreeCache node?
galder.zamarreno Sep 5, 2012 12:08 PM (in response to bill.burke)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
-
7. Re: Expiration for TreeCache node?
galder.zamarreno Sep 5, 2012 12:10 PM (in response to galder.zamarreno)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.