Tejas,
What is your use-case?
AffinityKey helps collocate related data. F.e. if you have Person and
Organization entities and want that Person`s related to Organization was
resided on the same node, you may use AffinityKey:
// Organizations.
Organization org1 = new Organization("ApacheIgnite");
Organization org2 = new Organization("Other");
orgCache.put(org1.id(), org1);
orgCache.put(org2.id(), org2);
// People.
Person p1 = new Person(org1, "John", "Doe", 2000, "John Doe has
Master Degree.");
Person p2 = new Person(org2, "John", "Smith", 1000, "John Smith has
Bachelor Degree.");
// These persons are collocated with their organizations.
// Preson.key() returns new AffinityKey(personId, organizationId)
colPersonCache.put(p1.key(), p1);
colPersonCache.put(p2.key(), p2);
// These Person objects are not collocated with their organizations.
personCache.put(p1.id, p1);
personCache.put(p2.id, p2);
Note that if you saved entry with AffinityKey you have to use that same key
to retrieve values.
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Affinity-Key-tp9772p9780.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.