Hello,
Affinity collocation what you need exactly.
Affinity function this is a mapping keys to partitions.
In other word when you are explicitly calling put(key, value), you are
implicitly assigning partition and node, where data will store.
But in many cases you want to store some data entries on same node. In this
case you can to use key with annotation @AffinityKeyMapped (or special class
AffinityKey), it means, what affinity-function took annotated property for
mapping key to partition.
For example:
Country
TID is pk
Department
CountryID is fk to Country
DID is pk
You can use new AffinityKey("entryID", "TID"); and put entries as this:
Country c1 = new Country (1);
Department d1 = new Department(1,1);
Department d2 = new Department(1,2);
Object ak1 = new AffinityKey(1, 1);
Object ak2 = new AffinityKey(2, 1);
countryCache.put(1, c1);
departmentCache.put(ak1, d1);
departmentCache.put(ak2, d2);
Also you can read this article:
https://apacheignite.readme.io/docs/affinity-collocation
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Affinity-Collocation-more-details-tp4876p4894.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.