Interface IFeatureToggleService
Minimal feature-toggle accessor: resolves a boolean flag from Quilt4Net remote configuration.
public interface IFeatureToggleService
Methods
GetToggleAsync(string, bool, TimeSpan?, string)
Resolves a boolean feature toggle. The value is cached locally with stale-while-revalidate and
falls back to fallback when the key is unknown or the server is unreachable.
ValueTask<bool> GetToggleAsync(string key, bool fallback = false, TimeSpan? ttl = null, string application = "")
Parameters
keystringToggle key.
fallbackboolValue returned when the key is unknown or the server is unreachable.
ttlTimeSpan?Optional client-requested cache lifetime. When
null, the team/server-configured default applies.applicationstringWhich application's toggle to read: empty string (the default) reads the shared, cross-application value;
nullreads the configured application's value (or the entry assembly name); a specific name reads that named application's value.
Returns
GetToggleResultAsync(string, bool, TimeSpan?, string)
As GetToggleAsync(string, bool, TimeSpan?, string), but also reports where the value came from (ConfigurationSource) — server, cache, stale cache or the caller's fallback.
ValueTask<ConfigurationResult<bool>> GetToggleResultAsync(string key, bool fallback = false, TimeSpan? ttl = null, string application = "")
Parameters
Returns
Remarks
GetToggleAsync(string, bool, TimeSpan?, string) cannot express the difference between "the server says this
feature is off" and "nothing has answered, so you are holding your own fallback". Under a
sustained fault those are the same false, which is how a toggle stayed pinned to its
fallback for two days without the application being able to say so (issue #174).
A default implementation is provided so adding this member does not break existing implementers of this public interface. It delegates to GetToggleAsync(string, bool, TimeSpan?, string) and reports Unknown rather than inventing a provenance it cannot know. The built-in implementation overrides it with the real source.