问题描述
我们希望在Java应用程序中进行一些处理,将结果存储在我们的memcache服务器池中,然后使用PHP中的memcache将其读回。
We would like to some processing in a Java application, store the results in our pool of memcache servers, and read it back using memcache in PHP.
这是很容易尝试,但我会问,看看是否有其他人这样做。
This is easy enough to try, but I though I would ask and see if anyone else has done this.
只要Java和PHP客户端都连接到同一个池memcache服务器,两个客户端是否都会哈希到同一服务器位置,从而可以从PHP中进行检索?
As long as both the Java and PHP clients connect to the same pool of memcache servers, will both clients hash to the same server location making retrieval from PHP possible?
推荐答案
没有。并非所有客户端都以相同方式散列。作为证据,你会看到一些客户提供一致性哈希,而其他客户则不提供。
No. Not all clients hash the same way. As evidence of this, you'll see that some clients offer "consistent hashing", while others don't.
简而言之,memcached客户端可以使用任何哈希值算法,他们请。没有官方标准。
In short, memcached clients are allowed to use any hashing algo they please. There is no official standard.
PHP客户端支持 - 所以有可能将它配置为使用你的Java库使用的相同算法(它看起来有几个 - 你使用的是哪些?)。但显然你会想要大量测试。
The PHP client supports a variety of hashing algorithms -- so it may be possible to configure it to use the same algo your Java library uses (it looks like there are several out there -- which are you using?). But you'll want to test heavily, obviously.
这篇关于不同语言的memcache客户端是否以相同的方式散列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!