Use TaskCache class from Microsoft.Extensions.TaskCache.Sources (#331)

Instead of Task.FromResult(0)
This commit is contained in:
Pavel Krymets 2016-09-07 10:16:58 -07:00 committed by GitHub
parent fa36a7bb53
commit 72c3688604
3 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
@ -99,7 +100,7 @@ namespace Microsoft.AspNetCore.Diagnostics
response.Headers[HeaderNames.Pragma] = "no-cache";
response.Headers[HeaderNames.Expires] = "-1";
response.Headers.Remove(HeaderNames.ETag);
return Task.FromResult(0);
return TaskCache.CompletedTask;
}
}
}

View File

@ -6,6 +6,7 @@ using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Builder
@ -118,7 +119,7 @@ namespace Microsoft.AspNetCore.Builder
{
var location = string.Format(CultureInfo.InvariantCulture, locationFormat, context.HttpContext.Response.StatusCode);
context.HttpContext.Response.Redirect(context.HttpContext.Request.PathBase + location);
return Task.FromResult(0);
return TaskCache.CompletedTask;
});
}
else
@ -127,7 +128,7 @@ namespace Microsoft.AspNetCore.Builder
{
var location = string.Format(CultureInfo.InvariantCulture, locationFormat, context.HttpContext.Response.StatusCode);
context.HttpContext.Response.Redirect(location);
return Task.FromResult(0);
return TaskCache.CompletedTask;
});
}
}

View File

@ -39,6 +39,10 @@
"type": "build",
"version": "1.1.0-*"
},
"Microsoft.Extensions.TaskCache.Sources": {
"version": "1.1.0-*",
"type": "build"
},
"Microsoft.Extensions.TypeNameHelper.Sources": {
"type": "build",
"version": "1.1.0-*"