@@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.OutputCaching.Memory;
10
10
internal sealed class MemoryOutputCacheStore : IOutputCacheStore
11
11
{
12
12
private readonly MemoryCache _cache ;
13
- private readonly Dictionary < string , HashSet < ValueTuple < string , Guid > > > _taggedEntries = [ ] ;
13
+ private readonly Dictionary < string , HashSet < ( string key , Guid entryId ) > > _taggedEntries = [ ] ;
14
14
private readonly object _tagsLock = new ( ) ;
15
15
16
16
internal MemoryOutputCacheStore ( MemoryCache cache )
@@ -21,7 +21,7 @@ internal MemoryOutputCacheStore(MemoryCache cache)
21
21
}
22
22
23
23
// For testing
24
- internal Dictionary < string , HashSet < string > > TaggedEntries => _taggedEntries . ToDictionary ( kvp => kvp . Key , kvp => kvp . Value . Select ( t => t . Item1 ) . ToHashSet ( ) ) ;
24
+ internal Dictionary < string , HashSet < string > > TaggedEntries => _taggedEntries . ToDictionary ( kvp => kvp . Key , kvp => kvp . Value . Select ( t => t . key ) . ToHashSet ( ) ) ;
25
25
26
26
public ValueTask EvictByTagAsync ( string tag , CancellationToken cancellationToken )
27
27
{
@@ -43,7 +43,7 @@ public ValueTask EvictByTagAsync(string tag, CancellationToken cancellationToken
43
43
var oldCount = keys . Count ;
44
44
foreach ( var tuple in keys )
45
45
{
46
- _cache . Remove ( tuple . Item1 ) ;
46
+ _cache . Remove ( tuple . key ) ;
47
47
i -- ;
48
48
if ( oldCount != keys . Count )
49
49
{
@@ -93,7 +93,7 @@ public ValueTask SetAsync(string key, byte[] value, string[]? tags, TimeSpan val
93
93
94
94
if ( ! _taggedEntries . TryGetValue ( tag , out var keys ) )
95
95
{
96
- keys = new HashSet < ValueTuple < string , Guid > > ( ) ;
96
+ keys = new HashSet < ( string , Guid ) > ( ) ;
97
97
_taggedEntries [ tag ] = keys ;
98
98
}
99
99
@@ -123,7 +123,7 @@ private void SetEntry(string key, byte[] value, string[]? tags, TimeSpan validFo
123
123
Size = value . Length
124
124
} ;
125
125
126
- if ( tags != null && tags . Length > 0 )
126
+ if ( tags is { Length : > 0 } )
127
127
{
128
128
// Remove cache keys from tag lists when the entry is evicted
129
129
options . RegisterPostEvictionCallback ( RemoveFromTags , ValueTuple . Create ( tags , entryId ) ) ;
@@ -136,9 +136,9 @@ void RemoveFromTags(object key, object? value, EvictionReason reason, object? st
136
136
{
137
137
Debug . Assert ( state != null ) ;
138
138
139
- var stateTuple = ( ValueTuple < string [ ] , Guid > ) state ;
140
- string [ ] tags = stateTuple . Item1 ;
141
- Guid entryId = stateTuple . Item2 ;
139
+ var stateTuple = ( ( string [ ] tags , Guid entryId ) ) state ;
140
+ var tags = stateTuple . tags ;
141
+ var entryId = stateTuple . entryId ;
142
142
143
143
Debug . Assert ( tags != null ) ;
144
144
Debug . Assert ( tags . Length > 0 ) ;
@@ -150,7 +150,7 @@ void RemoveFromTags(object key, object? value, EvictionReason reason, object? st
150
150
{
151
151
if ( _taggedEntries . TryGetValue ( tag , out var tagged ) )
152
152
{
153
- tagged . Remove ( ValueTuple . Create ( ( string ) key , entryId ) ) ;
153
+ tagged . Remove ( ( key : ( string ) key , entryId ) ) ;
154
154
155
155
// Remove the collection if there is no more keys in it
156
156
if ( tagged . Count == 0 )
0 commit comments