Skip to content

Commit

Permalink
example: memcache: fix set command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Daniel Norberg authored and normanmaurer committed Dec 5, 2014
1 parent c797e7b commit 4e09c30
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)

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);
Expand Down

0 comments on commit 4e09c30

Please sign in to comment.