Exemple #1
0
            internal override Result Parse(RedisExecutor executor)
            {
                executor.AssertType(RedisReplyType.MultiBulk);
                var count = executor.ReadInteger(false);

                if (count != this._tranCommands.Count)
                {
                    throw new RedisProtocolException(String.Format("预期 {0} 事务返回项,实际只有 {1} 个返回项。", this._tranCommands.Count, count));
                }
                var            node   = this._tranCommands.First;
                Queue <object> values = new Queue <object>((int)count);

                try
                {
                    do
                    {
                        values.Enqueue(node.Value.ObjectParse(executor));
                        node = node.Next;
                    } while(node != null);
                }
                catch (Exception)
                {
                    this._tranCommands.Clear();
                    throw;
                }

                this._tranCommands.Each(command => command.RunCallback(values.Dequeue()));
                this._tranCommands.Clear();
                return(Result.Successfully);
            }
Exemple #2
0
            internal override T[] Parse(RedisExecutor executor)
            {
                executor.AssertType(RedisReplyType.MultiBulk);
                long count = executor.ReadInteger(false);

                return(Read(count / this._parseItemCount, executor).ToArray());
            }
Exemple #3
0
 internal override T[] Parse(RedisExecutor executor)
 {
     executor.AssertType(RedisReplyType.MultiBulk);
     if (executor.ReadInteger(false) != 2)
     {
         throw new RedisProtocolException("预期返回 2 个项。");
     }
     this.Cursor = Int64.Parse(executor.ReadBulkString());
     return(base.Parse(executor));
 }
Exemple #4
0
            internal override Int64?Parse(RedisExecutor executor)
            {
                var type = executor.ReadType();

                if (type == RedisReplyType.Integer)
                {
                    return(executor.ReadInteger(false));
                }
                executor.ReadBulkString(false);
                return(null);
            }
Exemple #5
0
 internal override Int64 Parse(RedisExecutor executor)
 {
     return(executor.ReadInteger());
 }
Exemple #6
0
 internal override DateTime Parse(RedisExecutor executor)
 {
     return(FromTimestamp(executor.ReadInteger()));
 }
Exemple #7
0
 internal override bool Parse(RedisExecutor executor)
 {
     return(executor.ReadInteger() == 1);
 }