Example #1
0
            internal override Int64?Parse(RedisExecutor executor)
            {
                var type = executor.ReadType();

                if (type == RedisReplyType.Integer)
                {
                    return(executor.ReadInteger(false));
                }
                executor.ReadBulkString(false);
                return(null);
            }
Example #2
0
            internal override bool Parse(RedisExecutor executor)
            {
                var type = executor.ReadType(false);
                var str  = executor.ReadLine();

                if (type == RedisReplyType.Error)
                {
                    return(false);
                }

                return(Int64.Parse(str) == 1);
            }
Example #3
0
        internal override BinaryValue Parse(RedisExecutor executor)
        {
            var type = executor.ReadType();

            if (type == RedisReplyType.Bulk)
            {
                var bytes = executor.ReadBulk(false);
                if (bytes == null || bytes.Length == 0)
                {
                    return(null);
                }
                return(new BinaryValue(bytes));
            }

            executor.AssertType(RedisReplyType.MultiBulk, type);
            executor.AssertSize(-1);
            return(null);
        }
Example #4
0
            internal override bool Parse(RedisExecutor executor)
            {
                var type = executor.ReadType();

                if (type == RedisReplyType.Status)
                {
                    if (executor.ReadStatus(false).IsSucceed)
                    {
                        return(true);
                    }
                    return(false);
                }
                object[] result = executor.ReadMultiBulk(false);
                if (result != null)
                {
                    throw new RedisProtocolException("预期空的多条批量回复,实际出现未知回复。 ");
                }

                return(false);
            }