I’ve fixed the examples in the docs [1]. Thanks pointing out to this! Also you may refer to CacheQueryExample.initialized() method to see how it works in practice. The example is delivered as a part of Ignite release bundles. [2]
Feel free to ask if anythings is still unclear. [1] https://apacheignite.readme.io/docs/affinity-collocation <https://apacheignite.readme.io/docs/affinity-collocation> [2] https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java <https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java> — Denis > On May 27, 2016, at 6:33 AM, amitpa <[email protected]> wrote: > > Hey Thanks for the reply. > > I am copying the example here :- > > / Instantiate person keys with the same company ID which is used as affinity > key. > Object personKey1 = new PersonKey("myPersonId1", "myCompanyId"); > Object personKey2 = new PersonKey("myPersonId2", "myCompanyId"); > > Person p1 = new Person(personKey1, ...); > Person p2 = new Person(personKey2, ...); > > // Both, the company and the person objects will be cached on the same node. > cache.put("myCompanyId", new Company(...)); > cache.put(personKey1, p1); > cache.put(personKey2, p2); > > From the example it doesnt appear that we can put it in different caches. > See both are putting to the same cache. > > Is there any exampel of using different caches for storing related domain > objects, how does Ignite figure out colocation in that case? Sorry for the > questions, but it got me confused. > > Also how do you configure partitions for a cache? > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/Affinity-Key-Mapping-tp5212p5265.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com.
