public override string Parse(RedisReader reader)
            {
                RedisMessage type = reader.ReadType();

                if (type == RedisMessage.Bulk)
                {
                    return(reader.ReadBulkString(false));
                }
                reader.ReadMultiBulk(false);
                return(null);
            }
Beispiel #2
0
            public override long?Parse(RedisReader reader)
            {
                RedisMessage type = reader.ReadType();

                if (type == RedisMessage.Int)
                {
                    return(reader.ReadInt(false));
                }
                reader.ReadBulkString(false);
                return(null);
            }
        private static string Read(Stream stream)
        {
            var type = RedisReader.ReadType(stream);

            if (type == RedisMessage.Bulk)
            {
                return(RedisReader.ReadBulkUTF8(stream, false));
            }
            RedisReader.ReadMultiBulk(stream, false);
            return(null);
        }
        private static long?ParseStream(Stream stream)
        {
            RedisMessage type = RedisReader.ReadType(stream);

            if (type == RedisMessage.Int)
            {
                return(RedisReader.ReadInt(stream, false));
            }

            RedisReader.ReadBulkUTF8(stream, false);
            return(null);
        }
Beispiel #5
0
        public override string Parse(RedisReader reader)
        {
            if (IsEmpty)
            {
                RedisMessage type = reader.ReadType();
                if ((int)type == -1)
                {
                    return(string.Empty);
                }
                else if (type == RedisMessage.Error)
                {
                    throw new RedisException(reader.ReadStatus(false));
                }

                throw new RedisProtocolException($"Unexpected type: {type}");
            }
            else if (IsNullable)
            {
                RedisMessage type = reader.ReadType();
                if (type == RedisMessage.Status)
                {
                    return(reader.ReadStatus(false));
                }

                object[] result = reader.ReadMultiBulk(false);
                if (result != null)
                {
                    throw new RedisProtocolException($"Expecting null MULTI BULK response. Received: {result.ToString()}");
                }

                return(null);
            }
            else
            {
                return(reader.ReadStatus());
            }
        }
            public override string Parse(RedisReader reader)
            {
                RedisMessage type = reader.ReadType();

                if ((int)type == -1)
                {
                    return(String.Empty);
                }
                else if (type == RedisMessage.Error)
                {
                    throw new RedisException(reader.ReadStatus(false));
                }

                throw new RedisProtocolException("Unexpected type: " + type);
            }
Beispiel #7
0
        private static string ParseStream(Stream stream)
        {
            RedisMessage type = RedisReader.ReadType(stream);

            if (type == RedisMessage.Status)
            {
                return(RedisReader.ReadStatus(stream, false));
            }

            object[] result = RedisReader.ReadMultiBulk(stream, false);
            if (result != null)
            {
                throw new RedisProtocolException("Expecting null MULTI BULK response. Received: " + result.ToString());
            }
            return(null);
        }
            public override string Parse(RedisReader reader)
            {
                RedisMessage type = reader.ReadType();

                if (type == RedisMessage.Status)
                {
                    return(reader.ReadStatus(false));
                }

                object[] result = reader.ReadMultiBulk(false);
                if (result != null)
                {
                    throw new RedisProtocolException("Expecting null MULTI BULK response. Received: " + result.ToString());
                }

                return(null);
            }
Beispiel #9
0
            public override string Parse(RedisReader reader)
            {
                RedisMessage type = reader.ReadType();

                if (type == RedisMessage.Status)
                {
                    return(reader.ReadStatus(false));
                }

                object[] result = reader.ReadMultiBulk(false);
                if (result != null && result.Length > 0)
                {
                    throw new RedisProtocolException("Expecting null MULTI BULK response for command '" + this.Command + "'. Received: " + String.Join(", ", result));
                }

                return(null);
            }