Im using xmemcached to write memcacheclient. Now I want to have a method like: set(key, byte[]) and get(key) return byte[] in memcache client. Anyone can suggest me something to do that in XMEMCACHED. In my case, Im using protocol buffer to serial/deserial objects, then store them to Memcache. Thanks so much.
Asked
Active
Viewed 235 times
2 Answers
0
To be able to get byte[] value with XMemcached I implemented my own transcoder:
public class ByteArrayTranscoder implements net.rubyeye.xmemcached.transcoders.Transcoder<byte[]>
{
@Override
public byte[] decode(CachedData d)
{
return d.getData();
}
@Override
public CachedData encode(byte[] o)
{
throw new UnsupportedOperationException();
}
// UnsupportedOperationException for all other methods
}
Usage:
byte[] value = client.get(queueName, new ByteArrayTranscoder())
Probably, the same trick can be done for setting value, though I didn't tried it.

Dmitry
- 2,943
- 1
- 23
- 26
-1
I think you can set the byte array directly.

killme2008
- 207
- 2
- 4
-
1this does not provide an answer to the question. it's just a hint or rather a notion and should be posted as a comment under the question. even if it was... in majority of cases one short sentence is *not* helpful. even if you know the technology well, OP might not. – andr Feb 22 '13 at 06:22