A light implementation of the Microsoft.FeatureManagement IFeatureManager interface. Supports read-only ISessionManager instances and boolean null/true/false values.
$ dotnet add package Lussatite.FeatureManagementA lightweight implementation of the Microsoft.FeatureManagement IFeatureManager interface. The dependencies are a list of feature name strings and an ordered set of ISessionManager instances. When a feature flag value is requested, the ISessionManager instances will be polled in order until one returns a definitive answer (true/false).
LussatiteFeatureManager instance will always return false.ISessionManagers matters, each takes priority over later ones.ISessionManager should return null if it does not have a definitive answer. This allows layering.LussatiteFeatureManager implementation will not write back to the ISessionManager instances via SetAsync(string featureName, bool enabled).A lightweight implementation of the Microsoft.FeatureManagement IFeatureManagerSnapshot interface. When a feature flag value is requested, the ISessionManager instances will be polled in order until one returns a definitive answer (true/false).
Because this is a caching implementation, the first value read by the LussatiteLazyCacheFeatureManager instance will continue to be the value returned for the life of the instance. Even if a new value is registered in one of the ISessionManager instances.
LussatiteLazyCacheFeatureManager instance will always return false.ISessionManagers matters, each takes priority over later ones.ISessionManager should return null if it does not have a definitive answer. This allows layering.LussatiteLazyCacheFeatureManager implementation will not write back to the ISessionManager instances via SetAsync(string featureName, bool enabled).It uses LazyCache under the hood.
The non-standard Task CacheAllFeatureValuesAsync() method can be used after construction to poll all ISessionManager instances for values for each feature name registered within the LussatiteLazyCacheFeatureManager instance. This sets the values of all known features at the time of the call.