infinispan中的自定义哈希函数 [英] Custom hashing function in infinispan

查看:113
本文介绍了infinispan中的自定义哈希函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Infinispan版本8.2,我已经知道节点何时将条目放入缓存,它会在密钥上使用其内部哈希并选择集群中的主节点。

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.

在此先感谢。 / p>

Thanks in advance.

推荐答案

如果您要谈论确定hashCode(这主要影响到映射Object->段),那么这很简单:

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)

不要将此与 consistentHash (名称指的是不再使用的旧算法)混淆,后者将段映射到实际节点。您也可以覆盖其中一个,但是正确设置可能很棘手。

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.

这篇关于infinispan中的自定义哈希函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆