Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-08 Thread Denis Magda
Hi, Please see below > On Jun 8, 2016, at 2:36 PM, Kamal C wrote: > > In `put` operation, we have full object to insert so construction of > PersonKey / > AffinityKey is not a problem. But, during `get` operation, we may have only > the simple key to retrieve data. >

Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-08 Thread Vladislav Pyatkov
Hello Kamal, I will repeat, but you can use the ScanQuery. org.apache.ignite.cache.query.ScanQuery#setPartition You have only to find a local partition: Affinity affinity = ignite.affinity(cacheName); List partitions = new ArrayList<>(affinity.partitions()); for (int i = 0; i <

Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-08 Thread Kamal C
In my app, I'm trying to replace the existing ehcache implementation to Ignite caches. Using Affinity Collocation, I've collocated the data in the caches which are accessed together. In many places, I've only SIMPLE key to retrieve the data from the caches. (e.g. Retrieval from Person cache with

Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-06 Thread Denis Magda
Hi Kamal, There is no need to use any workaround like ScanQueries or iterators. You just need to use a valid key to retrieve the data. The valid key in your example is new AffinityKey<>(key, affray). It means that every time you need to put or get a Person from the cache you need to use this

Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-06 Thread Kamal C
Thanks for your response Vladislav. Both ScanQuery and Iterator traverses the whole cache to find the value. It may not be suitable in my environment as there can be huge number of hits. I understand that for fast retrieval `key-to-partition` mapping is done. But, In AffinityKey documentation,

Re: How to retrieve data from Collocated Cache with Simple Key

2016-06-06 Thread Vladislav Pyatkov
Hello Jamal, I think so, It not possible, because data store in particular partition, which determine only by affinityKey. More useful case, when you are not know fullKey, use ScanQuery(1) or use cache iterator. (1): https://apacheignite.readme.io/docs/cache-queries On Jun 6, 2016 3:34 PM,