[infinispan-dev] Design change in Infinispan Query

Emmanuel Bernard emmanuel at hibernate.org
Thu Feb 6 04:27:45 EST 2014


On Wed 2014-02-05 21:40, Mircea Markus wrote:
> 
> On Feb 5, 2014, at 7:34 PM, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> 
> > On Wed 2014-02-05 17:44, Radim Vansa wrote:
> >> On 02/05/2014 05:30 PM, Emmanuel Bernard wrote:
> >>> On Wed 2014-02-05 15:53, Mircea Markus wrote:
> >>>> On Feb 3, 2014, at 9:32 AM, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> >>>> 
> >>>>> Sure searching for any cache is useful. What I was advocating is that if you search for more than one cache transparently, then you probably need to CRUD for more than one cache transparently as well. And this is not being discussed.
> >>>> Not sure what you mean by CRUD over multiple caches? ATM one can run a TX over multiple caches, but I think there's something else you have in mind :-)
> >>> 
> >>> //some unified query giving me entries pointing by fk copy to bar and
> >>> //buz objects. So I need to manually load these references.
> >>> 
> >>> //happy emmanuel
> >>> Cache unifiedCache = cacheManager.getMotherOfAllCaches();
> >>> Bar bar = unifiedCache.get(foo);
> >>> Buz buz = unifiedCache.get(baz);
> >>> 
> >>> //not so happy emmanuel
> >>> Cache fooCache = cacheManager.getCache("foo");
> >>> Bar bar = fooCache.get(foo);
> >>> Cache bazCache = cacheManager.getCache("baz");
> >>> Buz buz = bazCache.put(baz);
> >> 
> >> cacheManager.getCache("foo").put("xxx", "yyy");
> >> cacheManager.getCache("foo").put("xxx", "zzz");
> >> 
> >> String xxx = cacheManager.getMotherOfAllCaches().get("xxx");
> >> System.out.println(xxx);
> >> 
> >> What should it print? Should an exception be thrown? Or should get on 
> >> mother of all caches return Map<Cache<String, String>, String>?
> >> 
> > 
> > Yes I'm aware of that.
> > What I am saying is that the idea of search across caches as
> > appealing as it is is is not the whole story.
> > 
> > People search, read, navigate and M/R their data in interleaved ways.
> 
> In all the non-trivial deployments I saw people used multiple caches for different data, instead of one. That's why for me this came as the straight forward way of structuring data and naturally I thought that querying multiple caches makes sense in this context: to allow querying to run over a model that is already in use and not to change the model to accommodate querying. 

Maybe it is but what is the right way to address that? What does the API
flow look like? Is that one app using 50 or 100 cache and juggling with
them or rather 50 apps using the same shared grid and using 1 maybe 2
cache.
Just to be clear, I think cross cache querying is something we need. I
am just questioning how it will be used in a bigger context and how the
over Infinispan API should look like to address the bigger context.

BTW the example you saw, Is that one cache per atomic type or rather one cache per
family of data.


More information about the infinispan-dev mailing list