Mikael, If you choose to use *AffinityKey* to wrap your keys, then you should use it everywhere. Because basically it's just a tuple of a key and affinity key, so this pair is used as a composite key.
You can also annotate some field of you key class with *@AffinityKeyMapped*, instead of using *AffinityKey* wrapper*.* To see all options, refer to the following page of documentation: https://apacheignite.readme.io/docs/affinity-collocation Denis пн, 27 нояб. 2017 г. в 1:19, Mikael <[email protected]>: > I was hoping it would work with either one as it is using equals() for > comparison and AffinityKey calls the keys hash/equals method. > > I guess I have to keep the AffinityKeys stored somewhere to make it work. > > Thanks > > Mikael > > Den 2017-11-26 kl. 21:36, skrev Gaurav Bajaj: > > Hi, > > You have to alwaya use affinity key to access the Cache for any get, put, > remove operation you do. Key should be exactly same as you used to put > value else it won't be able to find it. > > Thanks, > Gaurav > > On 26-Nov-2017 3:19 PM, "Mikael" <[email protected]> wrote: > > Hi! > > If I do a cache.put( new AffinityKey( key, value), myvalue); and later on > want to update the value, do I need do a: > > cache.put( new AffinityKey( key, value), newvalue); or can I do: > > cache.put( key, newvalue); > > If I do a put on a value that is already in the cache using a "non" > affinity key, will the existing affinity information on the key be lost of > I don't use the AffinityKey everytime I update the cache ? > > > > >
