spymemcached 2.7 "touch"
key="spoon"
value="Hello World!"
This is the key value stored on my cluster, and I'm using spymemcached 2.7.3. I want to update the amount of time the key is good for from 10seconds to 100.
If the key exists, "Hello World!" is printed, and I proceed to run touch as follows:
client.touch("spoon",100);
When executing the code, here's what happens:
Hello World!
Exception in thread "main" java.lang.UnsupportedOperationException: Touch is not supported for ASCII protocol
at net.spy.memcached.protocol.ascii.AsciiOperationFactory.touch(AsciiOperationFactory.java:87)
at net.spy.memcached.MemcachedClient.touch(MemcachedClient.java:551)
at net.spy.memcached.MemcachedClient.touch(MemcachedClient.java:531)
at Main.main(Main.java:21)
All, I just looked in the Membase source and touch is supported in 1.7.1. I also tested this against Membase 1.7.1 and it worked fine. The reason for the error here is that touch is not supported in the ASCII protocol as the error says. If you change your client to use the binary protocol this operation will work correctly.
Oh, you're right Mike. Sorry, I remembered that incorrectly.
Being new to Membase, what will changing from ASCII to Binary effect? I haven't done much with Membase yet, only testing the API calls and what not so making the switch will not have any immediate changes, but I imagine something will be different down the road.
Thanks again
You shouldn't notice any changes in your application code between the ASCII and binary protocol. In fact binary protocol should be preferred over ASCII.
The touch command is part of Couchbase Server 2.0, it is not available in Membase 1.7.