code: private static BinaryMemcacheRequest handleStoreRequest(final ChannelHandlerContext ctx,
          final BinaryStoreRequest msg) {
          ByteBuf extras = ctx.alloc().buffer(8);
          extras.writeInt(msg.flags());
          extras.writeInt(msg.expiration());
  
          byte[] key = msg.keyBytes();
          short keyLength = (short) key.length;
          byte extrasLength = (byte) extras.readableBytes();
          FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(key, extras, msg.content());
  
          if (msg instanceof InsertRequest) {
              request.setOpcode(OP_INSERT);
          } else if (msg instanceof UpsertRequest) {
              request.setOpcode(OP_UPSERT);
          } else if (msg instanceof ReplaceRequest) {
              request.setOpcode(OP_REPLACE);
              request.setCAS(((ReplaceRequest) msg).cas());
          } else {
              throw new IllegalArgumentException("Unknown incoming BinaryStoreRequest type "
                  + msg.getClass());
          }
  
          request.setKeyLength(keyLength);
          request.setTotalBodyLength(keyLength + msg.content().readableBytes() + extrasLength);
          request.setExtrasLength(extrasLength);
          return request;
      }
docs: Encodes a {@link BinaryStoreRequest} into its lower level representation.
  
  There are three types of store operations that need to be considered: insert, upsert and replace, which
  directly translate to the add, set and replace binary memcached opcodes. By convention, only the replace
  command supports setting a CAS value, even if the others theoretically would do as well (but do not provide
  benefit in such cases).
  
  Currently, the content is loaded and sent down in one batch, streaming for requests is not supported.
  
  @return a ready {@link BinaryMemcacheRequest}.