List of usage examples for io.netty.handler.codec.memcache.binary BinaryMemcacheOpcodes ADD
byte ADD
To view the source code for io.netty.handler.codec.memcache.binary BinaryMemcacheOpcodes ADD.
Click Source Link
From source file:com.couchbase.client.core.endpoint.binary.BinaryCodec.java
License:Open Source License
/** * Creates the actual protocol level request for an incoming insert request. * * @param request the incoming insert request. * @param ctx the channel handler context for buffer allocations. * @return the built protocol request.//from w w w . ja v a 2 s . c o m */ private BinaryMemcacheRequest handleInsertRequest(final InsertRequest request, final ChannelHandlerContext ctx) { ByteBuf extras = ctx.alloc().buffer(8); extras.writeInt(request.flags()); extras.writeInt(request.expiration()); FullBinaryMemcacheRequest msg = new DefaultFullBinaryMemcacheRequest(request.key(), extras, request.content()); msg.setOpcode(BinaryMemcacheOpcodes.ADD); msg.setKeyLength((short) request.key().length()); msg.setTotalBodyLength( (short) request.key().length() + request.content().readableBytes() + extras.readableBytes()); msg.setReserved(request.partition()); msg.setExtrasLength((byte) extras.readableBytes()); return msg; }