example: memcache: fix set command

Motivation:

The example MemcacheClient set command doesn't work.

Modifications:

Fill the extras field buffer with zeros so that it gets written to the
request payload.

Result:

The example MemcacheClient set command works.
This commit is contained in:
Daniel Norberg 2014-12-05 16:32:30 +09:00 committed by Norman Maurer
parent c797e7bdc5
commit 4e09c305ab

View File

@ -54,6 +54,7 @@ public class MemcacheClientHandler extends ChannelHandlerAdapter {
ByteBuf content = Unpooled.wrappedBuffer(value.getBytes(CharsetUtil.UTF_8));
ByteBuf extras = ctx.alloc().buffer(8);
extras.writeZero(8);
BinaryMemcacheRequest req = new DefaultFullBinaryMemcacheRequest(key, extras, content);
req.setOpcode(BinaryMemcacheOpcodes.SET);