コード例 #1
0
        public RespBuilder AppendRespSimpleString(string value)
        {
            byte[] encodedValue = Constants.SIMPLE_REDIS_ENCODING.GetBytes(value);

            if (encodedValue.Contains((byte)'\r') || encodedValue.Contains((byte)'\n'))
            {
                throw new ArgumentException("Simple strings may not contain \r or \n.", nameof(value));
            }

            _builder.Write((byte)'+');
            _builder.Write(encodedValue);
            _builder.Write(CRLF);

            _elementCount++;

            return(this);
        }
コード例 #2
0
 // NOTE: Append is called by the client to add new (incoming) RESP data to our buffer
 public void Append(byte value)
 {
     _buffer.Write(value);
 }