private void encode(CompositeByteBuf out, RedisCommand<?, ?, ?> command, int argsCount) {
        try {
            out.markWriterIndex();
            CommandArgs<?, ?> args = command.getArgs();
            int length = 1 + argsCount; // one for the command type
            out.addComponent(true, CommandArgsUtil.COMMAND_TYPE_FLAG)
                    .addComponent(true, CommandArgsUtil.getArgLength(length))
                    .addComponent(true, CommandArgsUtil.CRLF)
                    .addComponent(true, getProtocolKeywordBuffer(command.getType()));
            // We don't use arg.encode because it cannot
            // encode data according to its type (e.g. hash key, hash field, geo member)
            CommandArgsUtil.encodeArgs(out, args);
        } catch (RuntimeException e) {
            out.resetWriterIndex();
            command.completeExceptionally(new EncoderException(
                    "Cannot encode command "
                            + command
                            + ". Please close the connection as the connection state may be out of sync.",
                    e));
        }
    }
@author James Chen
@implNote We don't use MessageToByteEncoder because they will release the input buffer while we
          need to reuse the input buffer to compose a composite buffer.
@see CommandEncoder
@see CommandArgsUtil
turms-server-common/src/main/java/im/turms/server/common/storage/redis/command/TurmsCommandEncoder.java