@@ -9,13 +9,13 @@ namespace Microsoft.AspNetCore.OutputCaching;
99/// <summary>
1010/// Formats <see cref="OutputCacheEntry"/> instance to match structures supported by the <see cref="IOutputCacheStore"/> implementations.
1111/// </summary>
12- internal class OutputCacheEntryFormatter
12+ internal static class OutputCacheEntryFormatter
1313{
14- public static async ValueTask < OutputCacheEntry ? > GetAsync ( string key , IOutputCacheStore store , CancellationToken token )
14+ public static async ValueTask < OutputCacheEntry ? > GetAsync ( string key , IOutputCacheStore store , CancellationToken cancellationToken )
1515 {
1616 ArgumentNullException . ThrowIfNull ( key ) ;
1717
18- var content = await store . GetAsync ( key , token ) ;
18+ var content = await store . GetAsync ( key , cancellationToken ) ;
1919
2020 if ( content == null )
2121 {
@@ -24,7 +24,7 @@ internal class OutputCacheEntryFormatter
2424
2525 using var br = new MemoryStream ( content ) ;
2626
27- var formatter = await JsonSerializer . DeserializeAsync ( br , FormatterEntrySerializerContext . Default . FormatterEntry , cancellationToken : token ) ;
27+ var formatter = await JsonSerializer . DeserializeAsync ( br , FormatterEntrySerializerContext . Default . FormatterEntry , cancellationToken : cancellationToken ) ;
2828
2929 if ( formatter == null )
3030 {
@@ -52,7 +52,7 @@ internal class OutputCacheEntryFormatter
5252 return outputCacheEntry ;
5353 }
5454
55- public static async ValueTask StoreAsync ( string key , OutputCacheEntry value , TimeSpan duration , IOutputCacheStore store , CancellationToken token )
55+ public static async ValueTask StoreAsync ( string key , OutputCacheEntry value , TimeSpan duration , IOutputCacheStore store , CancellationToken cancellationToken )
5656 {
5757 ArgumentNullException . ThrowIfNull ( value ) ;
5858
@@ -75,7 +75,7 @@ public static async ValueTask StoreAsync(string key, OutputCacheEntry value, Tim
7575
7676 using var br = new MemoryStream ( ) ;
7777
78- await JsonSerializer . SerializeAsync ( br , formatterEntry , FormatterEntrySerializerContext . Default . FormatterEntry , token ) ;
79- await store . SetAsync ( key , br . ToArray ( ) , value . Tags ?? Array . Empty < string > ( ) , duration , token ) ;
78+ await JsonSerializer . SerializeAsync ( br , formatterEntry , FormatterEntrySerializerContext . Default . FormatterEntry , cancellationToken ) ;
79+ await store . SetAsync ( key , br . ToArray ( ) , value . Tags ?? Array . Empty < string > ( ) , duration , cancellationToken ) ;
8080 }
8181}
0 commit comments