-
1. Re: hotrod implementation with treecache model
nadirx Jan 5, 2015 10:25 AM (in response to manuelfranqueira)1 of 1 people found this helpfulHi Manuel,
the tree module is only a layer to provide some form of backwards compatibility for jbosscache applications. It is unmaintained and unsupported and we recommend applications to use the Cache interface instead. Because it requires some atomic operations which are not available remotely, it is impossible to provide a remote variant at the moment
Tristan
-
2. Re: hotrod implementation with treecache model
manuelfranqueira Jan 5, 2015 11:36 AM (in response to nadirx)Thanks Tristan for your useful answer!
I needed tree model because I needed to remove at same time two or more child of a node in a tree, for example, "a/b/1" and "a/b/2".
Using RemoteCache there is a way to remove the subpath's of a key?
For example, my cache has the following entries:
a/b/1
a/b/2
Can I remove the two entries in same time? Like writing "a/b"...?
Thanks again!
Manuel
-
3. Re: hotrod implementation with treecache model
rvansa Jan 6, 2015 3:15 AM (in response to manuelfranqueira)1 of 1 people found this helpfulNo, there's no such API. Probably the best option would be to use Distributed Entry Retriever with proper filter (selecting keys a/b/*) and null-converter to find those entries and call cache.removeAsync() on these.
-
4. Re: hotrod implementation with treecache model
manuelfranqueira Jan 6, 2015 3:52 AM (in response to rvansa)Thanks Radim!
I'll check Distributed Entry Retriever right away!
-
5. Re: hotrod implementation with treecache model
manuelfranqueira Jan 6, 2015 11:18 AM (in response to rvansa)Hi Radim,
Because I'm using Hotrod I have a RemoteCache class. The Distributed Entry Retriever filter needs to be applyed in a AdvancedCache. Can I convert a RemoteCache in a Cache or AdvancedCache?
How can I apply the filter to a remote cache?
-----------------------------------------------------------------------------------
Here's my code, hope it helps to clarify my doubt. (I have an Infinispan server and my code is in an JBoss 7 instance in a different server)
RemoteCacheManager remoteCacheManager = new RemoteCacheManager();
RemoteCache<String, Object> remoteCache = remoteCacheManager.getCache();
remoteCache.put("a/b/1", "test1");
remoteCache.put("a/b/2", "test2");
At this point I have two entries and I want to remove anything below "a/b" at once.
How can I do this with a RemoteCache instance? What I read about Distributed Entry Retriever I need to have an AdvancedCache.
-----------------------------------------------------------------------------------
Thanks a lot.
-
6. Re: hotrod implementation with treecache model
rvansa Jan 7, 2015 3:46 AM (in response to manuelfranqueira)I've missed the fact that you're using HotRod. In that case, distributed entry retrievers are not available in current version. You can use remote querying, though - but this requires you to store the keys (or rather the position in the tree) in the value, as AFAIK querying can be done only on values.
Non-indexed querying uses distributed entry retrievers underhood anyway. If you expect often writes to the cache, I'd recommend not to use indexing.