code: private void handleSnappyCompression(final ChannelHandlerContext ctx, final BinaryMemcacheRequest r) {
          if (!(r instanceof FullBinaryMemcacheRequest)) {
              // we only need to handle requests which send content
              return;
          }
  
          FullBinaryMemcacheRequest request = (FullBinaryMemcacheRequest) r;
          int uncompressedLength = request.content().readableBytes();
  
          // don't bother compressing if below the min compression size
          if (uncompressedLength < minCompressionSize || uncompressedLength == 0) {
              return;
          }
  
          ByteBuf compressedContent;
          try {
              compressedContent = tryCompress(request.content());
          } catch (Exception ex) {
              throw new RuntimeException("Could not snappy-compress value.", ex);
          }
  
          if (compressedContent != null) {
              // compressed is smaller, so adapt and apply new content
              request.setDataType((byte)(request.getDataType() | DATATYPE_SNAPPY));
              request.setContent(compressedContent);
              request.setTotalBodyLength(
                  request.getExtrasLength()
                      + request.getKeyLength()
                      + compressedContent.readableBytes()
              );
          }
      }
docs: Helper method which performs snappy compression on the request path.
  
  Note that even if we compress and switch out the content, we are not releasing the
  original buffer! This is happening on the decode side and we still need to keep in mind
  that a NMVB could be returned and the original msg needs to be re-sent.