Skip to content

Commit d1a156c

Browse files
committed
Enable TrackLinkedCacheEntries dotnet#36765
1 parent 8d4a033 commit d1a156c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Mvc/Mvc.TagHelpers/src/CacheTagHelperMemoryCacheFactory.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using Microsoft.Extensions.Caching.Memory;
@@ -20,7 +20,8 @@ public CacheTagHelperMemoryCacheFactory(IOptions<CacheTagHelperOptions> options)
2020
{
2121
Cache = new MemoryCache(new MemoryCacheOptions
2222
{
23-
SizeLimit = options.Value.SizeLimit
23+
SizeLimit = options.Value.SizeLimit,
24+
TrackLinkedCacheEntries = true,
2425
});
2526
}
2627

src/Mvc/Mvc.TagHelpers/src/DependencyInjection/TagHelperExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ internal static void AddCacheTagHelperServices(IServiceCollection services)
8484

8585
// Required default services for cache tag helpers
8686
services.AddDistributedMemoryCache();
87+
services.AddMemoryCache(options => options.TrackLinkedCacheEntries = true);
8788
services.TryAddSingleton<CacheTagHelperMemoryCacheFactory>();
8889
}
8990
}

src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,14 @@ public async Task ProcessAsync_UsesExpiresSliding_ToExpireCacheEntryWithSlidingE
485485
}
486486

487487
[Fact]
488-
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/36765")]
489488
public async Task ProcessAsync_FlowsEntryLinkThatAllowsAddingTriggersToAddedEntry()
490489
{
491490
// Arrange
492491
var id = "some-id";
493492
var expectedContent = new DefaultTagHelperContent();
494493
expectedContent.SetContent("some-content");
495494
var tokenSource = new CancellationTokenSource();
496-
var cache = new MemoryCache(new MemoryCacheOptions());
495+
var cache = new MemoryCache(new MemoryCacheOptions() { TrackLinkedCacheEntries = true });
497496
var cacheEntryOptions = new MemoryCacheEntryOptions()
498497
.AddExpirationToken(new CancellationChangeToken(tokenSource.Token));
499498
var tagHelperContext = new TagHelperContext(

src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ public async Task CacheTagHelper_VariesByUserId()
526526
}
527527

528528
[Fact]
529-
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/36765")]
530529
public async Task CacheTagHelper_BubblesExpirationOfNestedTagHelpers()
531530
{
532531
// Arrange & Act - 1

0 commit comments

Comments
 (0)