@@ -17,7 +17,7 @@ namespace Microsoft.FeatureManagement
17
17
class FeatureManagerSnapshot : IFeatureManagerSnapshot , IVariantFeatureManagerSnapshot
18
18
{
19
19
private readonly IVariantFeatureManager _featureManager ;
20
- private readonly ConcurrentDictionary < string , Task < bool > > _flagCache = new ConcurrentDictionary < string , Task < bool > > ( ) ;
20
+ private readonly ConcurrentDictionary < string , ValueTask < bool > > _flagCache = new ConcurrentDictionary < string , ValueTask < bool > > ( ) ;
21
21
private readonly ConcurrentDictionary < string , Variant > _variantCache = new ConcurrentDictionary < string , Variant > ( ) ;
22
22
private IEnumerable < string > _featureNames ;
23
23
@@ -55,24 +55,24 @@ public Task<bool> IsEnabledAsync(string feature)
55
55
{
56
56
return _flagCache . GetOrAdd (
57
57
feature ,
58
- ( key ) => _featureManager . IsEnabledAsync ( key , CancellationToken . None ) ) ;
58
+ ( key ) => _featureManager . IsEnabledAsync ( key , CancellationToken . None ) ) . AsTask ( ) ;
59
59
}
60
60
61
61
public Task < bool > IsEnabledAsync < TContext > ( string feature , TContext context )
62
62
{
63
63
return _flagCache . GetOrAdd (
64
64
feature ,
65
- ( key ) => _featureManager . IsEnabledAsync ( key , context , CancellationToken . None ) ) ;
65
+ ( key ) => _featureManager . IsEnabledAsync ( key , context , CancellationToken . None ) ) . AsTask ( ) ;
66
66
}
67
67
68
- public Task < bool > IsEnabledAsync ( string feature , CancellationToken cancellationToken )
68
+ public ValueTask < bool > IsEnabledAsync ( string feature , CancellationToken cancellationToken )
69
69
{
70
70
return _flagCache . GetOrAdd (
71
71
feature ,
72
72
( key ) => _featureManager . IsEnabledAsync ( key , cancellationToken ) ) ;
73
73
}
74
74
75
- public Task < bool > IsEnabledAsync < TContext > ( string feature , TContext context , CancellationToken cancellationToken )
75
+ public ValueTask < bool > IsEnabledAsync < TContext > ( string feature , TContext context , CancellationToken cancellationToken )
76
76
{
77
77
return _flagCache . GetOrAdd (
78
78
feature ,
0 commit comments