You don't need to write your own client, just to use SET commands instead 
of ADD.

For example, with the spymemcached library you should do something like:

MemcachedClient c=new MemcachedClient(
    new InetSocketAddress("hostname", portNum));

// Store a value (async) for one hour
c.set("someKey", 3600, someObject);
// Retrieve a value (synchronously).
Object myObject=c.get("someKey");


-- Tanguy

Le jeudi 2 octobre 2014 16:12:29 UTC+2, Ryan Bergman a écrit :
>
> I'm using 1.3.3 with a transport of 2.3.0
>
> I was attempting to use one of the standard common Memcache client 
> libraries that already exist. I was hoping that they would "just work" 
> without having to write my own client (or modifying one of them). It sounds 
> like that's not an option. Is there a plan for the transport to support ADD 
> in the future?
>
> Ryan
>
>
> On Thursday, October 2, 2014 2:27:58 AM UTC-5, Tanguy Leroux wrote:
>>
>> Hi,
>>
>> Which versions of elasticsearch / elasticsearch-transport-memcached / 
>> memcached are you using?
>>
>> It looks like the memcached client is trying to execute a 0x02 ADD 
>> command whereas the elasticsearch-transport-memcached only supports 
>> get/set/delete/quit commands and disconnects for all others (see 
>> documentation here: 
>> https://github.com/elasticsearch/elasticsearch-transport-memcached) 
>>
>> You may try a "set" instead.
>>
>> -- Tanguy
>>
>> Le mercredi 1 octobre 2014 15:35:40 UTC+2, Ryan Bergman a écrit :
>>>
>>> Hi,
>>>    I've been trying to play with Elasticsearch as a drop in replacement 
>>> for Memcached. I've installed the memcached transport and it looks like it 
>>> started fine and is on the right port. However if I attempt to use the java 
>>> spy.memcahed client library I'm not able to cache things.
>>>
>>> Instead I get errors like:
>>>
>>> 2014-10-01 08:22:31.579 INFO net.spy.memcached.MemcachedConnection: 
>>>  Added {QA sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, 
>>> topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
>>> 2014-10-01 08:22:31.586 INFO net.spy.memcached.MemcachedConnection: 
>>>  Connection state changed for sun.nio.ch.SelectionKeyImpl@76fb509a
>>> 2014-10-01 08:22:31.679 INFO net.spy.memcached.MemcachedConnection: 
>>>  Reconnecting due to exception on {QA sa=localhost/127.0.0.1:11211, 
>>> #Rops=2, #Wops=0, #iq=0, topRop=Cmd: 2 Opaque: 2 Key: foo Cas: 0 Exp: 1000 
>>> Flags: 0 Data Length: 3, topWop=null, toWrite=0, interested=1}
>>> java.io.IOException: Disconnected unexpected, will reconnect. 
>>>
>>> over and over.
>>>
>>> On the Elasticsearch side I get an error of
>>> [2014-10-01 08:22:31,675][ERROR][memcached.netty          ] [Living 
>>> Hulk] Unsupported opcode [0x2], ignoring and closing connection
>>>
>>> Here is my client configuration:
>>> ConnectionFactoryBuilder factory =  new ConnectionFactoryBuilder();
>>>         factory.setProtocol(ConnectionFactoryBuilder.Protocol.BINARY);
>>>         SerializingTranscoder t = new SerializingTranscoder(1000000);
>>>         t.setCompressionThreshold(1024);
>>>         factory.setTranscoder(t);
>>>         factory.setOpTimeout(1000);
>>>         factory.setTimeoutExceptionThreshold(1998);
>>>         factory.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH);
>>>         
>>> factory.setLocatorType(ConnectionFactoryBuilder.Locator.CONSISTENT);
>>>         factory.setFailureMode(FailureMode.Redistribute);
>>>         factory.setUseNagleAlgorithm(false);
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/106b7c04-04db-499a-9204-6d57d72a7278%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to