Anil, I think in your case Person's key and Persond details key should be same. Otherwise you will not be able get Person details from cache. Of course you can keep Person details key in Person instance but it seems that this relation is transitive and should be removed.
Other case that I can imagine is some complex key when with each person could be associated many person details entries. In this case you should use person key as affinity key for colocation person with person details on the same affinity nodes set. On Tue, Dec 27, 2016 at 2:20 PM, Anil <[email protected]> wrote: > Hi, > > is it mandatory to use key of a cache as part of the affinity key of another > cache ? > > i see all examples on github are using the same. > > In my scenario, key of a cache (person) cannot be part of affinity key of > another cache (person details). how can we achieve affinity? > > Thanks.
