本文整理汇总了C#中Request.GetExtra方法的典型用法代码示例。如果您正苦于以下问题:C# Request.GetExtra方法的具体用法?C# Request.GetExtra怎么用?C# Request.GetExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request.GetExtra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToCycleRetry
protected Page AddToCycleRetry(Request request, Site site)
{
Page page = new Page(request);
object cycleTriedTimesObject = request.GetExtra(Request.CycleTriedTimes);
if (cycleTriedTimesObject == null)
{
// 把自己加到目标Request中(无法控制主线程再加载此Request), 传到主线程后会把TargetRequest加到Pool中
request.Priority = 0;
page.AddTargetRequest(request.PutExtra(Request.CycleTriedTimes, 1));
}
else
{
long cycleTriedTimes = (long)cycleTriedTimesObject;
cycleTriedTimes++;
if (cycleTriedTimes >= site.CycleRetryTimes)
{
// 超过最大尝试次数, 返回空.
return null;
}
request.Priority = 0;
page.AddTargetRequest(request.PutExtra(Request.CycleTriedTimes, cycleTriedTimes));
}
page.SetNeedCycleRetry(true);
return page;
}
示例2: ShouldReserved
/// <summary>
/// �������URLִ��ʧ��, ������ӻ�TargetUrlsʱ��Hash���������¼�����е�����
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
private bool ShouldReserved(Request request)
{
var cycleTriedTimes = request.GetExtra(Request.CycleTriedTimes);
if (cycleTriedTimes == null)
{
return false;
}
else
{
return cycleTriedTimes > 0;
}
}
示例3: ShouldReserved
private bool ShouldReserved(Request request)
{
var cycleTriedTimes = (int?)request.GetExtra(Request.CycleTriedTimes);
return cycleTriedTimes > 0;
}