You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Maxim Malygin <ma...@gmail.com> on 2018/07/26 13:01:19 UTC

Constant affinity key for some set of caches

Hi,

I'd like to keep some set of caches together. In other words, I need that
all elements of, for example, cache1 and cache2 were collocated to one node.
I can do it by adding some additional field to their keys and initialize it
with the same constant value for all caches. But I don't want keep this
additional field as part of key because it will eat additional memory and
will do my code more complex.

Is it possible to do it without an additional field in keys?
I know there is AffinityKeyMapper which can be configured in
CacheConfiguration but it's marked as deprecated in 2.6.0.

Thanks,
Maxim

Re: Constant affinity key for some set of caches

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

You can extend RendezvousAffinityFunction overriding partition(Object)
method, pass an instance of such affinity function in those caches'
configurations.

Regards,

-- 
Ilya Kasnacheev

2018-07-26 16:01 GMT+03:00 Maxim Malygin <ma...@gmail.com>:

> Hi,
>
> I'd like to keep some set of caches together. In other words, I need that
> all elements of, for example, cache1 and cache2 were collocated to one node.
> I can do it by adding some additional field to their keys and initialize
> it with the same constant value for all caches. But I don't want keep this
> additional field as part of key because it will eat additional memory and
> will do my code more complex.
>
> Is it possible to do it without an additional field in keys?
> I know there is AffinityKeyMapper which can be configured in
> CacheConfiguration but it's marked as deprecated in 2.6.0.
>
> Thanks,
> Maxim
>