ChaseFlorell/FutureFlag

Cache Provider

Closed this issue · 0 comments

We need to be able to create a Cache provider that can wrap a given IFutureFlag in order to not hit IsEnabled (which might require processing).

// psudo-code DO NOT COPY AS DOCUMENTATION
public class CacheFutureFlag : IFutureFlag
{
    public TimeSpan CacheDuration { get; set; }
    public IFutureFlag FutureFlag { get; set; }
    public bool IsEnabled => _cachedValue.HasValue ? _cachedValue.Value : GetCachedValueAndApplyCache();
}