@@ -17,7 +17,7 @@ namespace Microsoft.FeatureManagement
1717 class FeatureManagerSnapshot : IFeatureManagerSnapshot , IVariantFeatureManagerSnapshot
1818 {
1919 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 > > ( ) ;
2121 private readonly ConcurrentDictionary < string , Variant > _variantCache = new ConcurrentDictionary < string , Variant > ( ) ;
2222 private IEnumerable < string > _featureNames ;
2323
@@ -55,24 +55,24 @@ public Task<bool> IsEnabledAsync(string feature)
5555 {
5656 return _flagCache . GetOrAdd (
5757 feature ,
58- ( key ) => _featureManager . IsEnabledAsync ( key , CancellationToken . None ) ) ;
58+ ( key ) => _featureManager . IsEnabledAsync ( key , CancellationToken . None ) ) . AsTask ( ) ;
5959 }
6060
6161 public Task < bool > IsEnabledAsync < TContext > ( string feature , TContext context )
6262 {
6363 return _flagCache . GetOrAdd (
6464 feature ,
65- ( key ) => _featureManager . IsEnabledAsync ( key , context , CancellationToken . None ) ) ;
65+ ( key ) => _featureManager . IsEnabledAsync ( key , context , CancellationToken . None ) ) . AsTask ( ) ;
6666 }
6767
68- public Task < bool > IsEnabledAsync ( string feature , CancellationToken cancellationToken )
68+ public ValueTask < bool > IsEnabledAsync ( string feature , CancellationToken cancellationToken )
6969 {
7070 return _flagCache . GetOrAdd (
7171 feature ,
7272 ( key ) => _featureManager . IsEnabledAsync ( key , cancellationToken ) ) ;
7373 }
7474
75- public Task < bool > IsEnabledAsync < TContext > ( string feature , TContext context , CancellationToken cancellationToken )
75+ public ValueTask < bool > IsEnabledAsync < TContext > ( string feature , TContext context , CancellationToken cancellationToken )
7676 {
7777 return _flagCache . GetOrAdd (
7878 feature ,
0 commit comments