Custom hashing function in infinispan

蓝咒 提交于 2019-12-11 05:25:49

问题


I am using Infinispan version 8.2 .I already knew when an Node puts an entry to an Cache.It uses its internal hashing on the key and chooses a primary node in an cluster.

I know that we can override this hashing with our custom hash function.But I don't know where to start and how to start.I have searched through a lot of documents and websites.But,none of them had a proper description in it.

I want someone to help me in this.

Thanks in advance.


回答1:


If you speak about determining the hashCode (which affect mostly mapping Object -> segment), this is pretty easy:

Hash myHash = ...;
ConfigurationBuilder cb = new ConfigurationBuilder()
cb.clustering().hash().hash(myHash)

Don't confuse this with consistentHash (the name refers to old algorithm that is not used anymore) which maps segments to actual nodes. You could override that one, too, but getting that right could be tricky.



来源:https://stackoverflow.com/questions/48933184/custom-hashing-function-in-infinispan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!