如何从Spymemcached客户端访问Infinispan Memcached Server缓存容器?

时间:2014-03-21 19:24:32

标签: caching memcached client infinispan

我在Infinispan上使用Memcached创建了一个分布式集群。

现在,我需要使用SpyMemcached客户端访问我的缓存。

我试过了:

AuthDescriptor ad2 = new AuthDescriptor(new String[]{"PLAIN"}, new PlainCallbackHandler("username", "cryptedpass"));
ConnectionFactoryBuilder factoryBuilder = new ConnectionFactoryBuilder();
SerializingTranscoder transcoder=new SerializingTranscoder();  
transcoder.setCompressionThreshold(1024);  

ConnectionFactory cf = factoryBuilder
   .setTranscoder(transcoder)
   .setOpTimeout(10000)
   .setMaxReconnectDelay(10000)
.setTimeoutExceptionThreshold(1998)   
   .setLocatorType(Locator.CONSISTENT)  
   .setFailureMode(FailureMode.Retry)   
   .setUseNagleAlgorithm(false)
   .setProtocol(Protocol.BINARY)                
   .setAuthDescriptor(ad2).build();
MemcachedClient memcachedClient = new MemcachedClient(cf,Collections.singletonList(new InetSocketAddress("ONE_NODE_IP_ADDRESS", 11211)));
memcachedClient.add("test", 0, "testData");

但是我收到了这个错误:

2014-03-21 19:19:22.952 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:  Operation canceled because authentication or reconnection and authentication has taken more than one second to complete.

在我看来,有点令人困惑。如果在一台机器上我有多个缓存,我的客户端会选择哪个缓存???

非常感谢你!

1 个答案:

答案 0 :(得分:0)

Infinispan仅支持Memcached协议的文本版本。