ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Berry <chriswbe...@gmail.com>
Subject Re: getAsMap ??
Date Thu, 17 Aug 2017 18:19:40 GMT
Thank you for the speedy reply.
I found that same information when I dug deeper last night.

And after working thru the annoying IncompatibleClassChangeError issue and
mismatched H2 classes,
I got it working.

For posterity, I ended up with this:

    public Set<TKey> getCacheKeys() {
        String tableName = valueClass.getSimpleName();
        SqlFieldsQuery qry = new SqlFieldsQuery("select _key from " +
        Collection<List&lt;?>> res =  igniteCacheHandle.query(qry).getAll();

        Set<TKey> keys = new HashSet<>();
        for(List<?> row : res) {
        return keys;

Using a SqlFieldsQuery.

And I use it like this:

    public List<Foo > findMatches(SearchTerms searchTerms) {
        Map<String, Foot> map = cache.getAll(cache.getCacheKeys());
        return matchingStrategy.match(map, searchTerms);

Which is pretty inefficient I think. But I wanted to get something working….

I have a few questions.

1) I have only one REPLICATED cache – out of many caches -- that I need to
do a Query against.
The rest are all used as simple KV stores.
Have I introduced an inefficiency by introducing the ignite-indexing
Is there a way to use it ONLY for 1 cache??
Or is indexing always present, and I have just now become aware of it??
(This seems unlikely since the H2 DB issue should have bitten me sooner??)

2) Would it be more efficient to use a ScanQuery??
Or is the SqlFieldsQuery roughly equivalent??

NOTE: I assume to do this whole thing more efficiently I would use a
ScanQuery with a Filter??
Which would eliminate the need for the interim copies.

3) I am using:  igniteConfig.setMarshaller(new BinaryMarshaller())  --
paired with:   cache.withKeepBinary()
Do I need to do anything special in this case??
Presently it seems not?? 
I am using only this: igniteCacheConfig.setIndexedTypes(keyClass,
And it all is working as expected.
Still. If I used IgniteBiPredictae would it be more efficient ??

Thanks agaian for your help.

-- Chris 

View this message in context: http://apache-ignite-users.70518.x6.nabble.com/getAsMap-tp16242p16259.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message