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); }
internal override T[] Parse(RedisExecutor executor) { executor.AssertType(RedisReplyType.MultiBulk); long count = executor.ReadInteger(false); return(Read(count / this._parseItemCount, executor).ToArray()); }
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)); }
internal override Int64?Parse(RedisExecutor executor) { var type = executor.ReadType(); if (type == RedisReplyType.Integer) { return(executor.ReadInteger(false)); } executor.ReadBulkString(false); return(null); }
internal override Int64 Parse(RedisExecutor executor) { return(executor.ReadInteger()); }
internal override DateTime Parse(RedisExecutor executor) { return(FromTimestamp(executor.ReadInteger())); }
internal override bool Parse(RedisExecutor executor) { return(executor.ReadInteger() == 1); }