public Dictionary <string, Evaluate> EvaluateAll(User user) { EnsureNotDisposed(); return(_featureControlCache .GetAll() .ToDictionary(_ => _.Key, _ => EvaluateInternal(_.Key, _.Value, user))); }
private async void OnTimer(object state) { try { if (_cts.IsCancellationRequested) { return; } var newFeatures = await _restClient.GetFeatureControlsAsync(_cts.Token).ConfigureAwait(false); if (_cts.IsCancellationRequested) { return; } var oldKeys = new HashSet <string>(_featureControlCache.GetAll().Keys); _featureControlCache.Update(newFeatures); foreach (var newFeature in newFeatures) { FeatureUpdated?.Invoke(this, new FeatureUpdatedEventArgs(newFeature.Key)); } oldKeys.ExceptWith(newFeatures.Keys); foreach (var missingKey in oldKeys) { FeatureDeleted?.Invoke(this, new FeatureDeletedEventArgs(missingKey)); } } finally { if (!_cts.IsCancellationRequested) { InitializeTimer(); } } }