Remove usage of TaskCache

This commit is contained in:
Pranav K 2017-06-08 08:52:32 -07:00
parent f5227bd719
commit 3909a5ce88
6 changed files with 9 additions and 15 deletions

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.ResponseCaching.Internal
{
@ -86,7 +85,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal
public Task SetAsync(string key, IResponseCacheEntry entry, TimeSpan validFor)
{
Set(key, entry, validFor);
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
}
}

View File

@ -20,7 +20,6 @@
<PackageReference Include="Microsoft.AspNetCore.Http" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.ResponseCaching.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
@ -314,7 +313,7 @@ namespace Microsoft.AspNetCore.ResponseCaching
{
return _cache.SetAsync(context.BaseKey, context.CachedVaryByRules, context.CachedResponseValidFor);
}
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
internal async Task FinalizeCacheBodyAsync(ResponseCachingContext context)
@ -378,7 +377,7 @@ namespace Microsoft.AspNetCore.ResponseCaching
{
return FinalizeCacheHeadersAsync(context);
}
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
internal static void AddResponseCachingFeature(HttpContext context)

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.ResponseCaching.Internal
{
@ -170,7 +169,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Write(buffer, offset, count);
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
public override void WriteByte(byte value)

View File

@ -7,7 +7,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.ResponseCaching.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
@ -857,7 +856,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
var middleware = TestUtils.CreateTestMiddleware(next: httpContext =>
{
responseCachingFeatureAdded = httpContext.Features.Get<IResponseCachingFeature>() != null;
return TaskCache.CompletedTask;
return Task.CompletedTask;
},
policyProvider: new TestResponseCachingPolicyProvider
{

View File

@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.ResponseCaching.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
@ -83,7 +82,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
{
context.Response.Write(uniqueId);
}
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
internal static IResponseCachingKeyProvider CreateTestKeyProvider()
@ -169,7 +168,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
{
if (next == null)
{
next = httpContext => TaskCache.CompletedTask;
next = httpContext => Task.CompletedTask;
}
if (cache == null)
{
@ -294,7 +293,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
{
public Task SendFileAsync(string path, long offset, long? count, CancellationToken cancellation)
{
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
}
@ -383,7 +382,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Tests
public Task SetAsync(string key, IResponseCacheEntry entry, TimeSpan validFor)
{
Set(key, entry, validFor);
return TaskCache.CompletedTask;
return Task.CompletedTask;
}
}