Hi Andrey,
thanks for quick response.
Unfortunately, person cache key cannot be used as affinity key for person
details in my case.
Person {
String personId
String equivalentId;
String name
}
PersonDetail {
String detailId;
Strign equivalentId;
}
Person cache :
key = personid
value = Person object
PersonDetail cache :
key = detailId
value = PersonDetail
the only relation between person and its details is *equivalentId*
can we achieve affinity with above entities ? thanks
On 27 December 2016 at 17:09, Andrey Gura <[email protected]> wrote:
> 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.
>