Example #1
0
        public ConfigCache(IConfigItemsSource source, IConfigurationDataWatcher watcher, ILog log)
        {
            Source = source;
            Log    = log;
            ConfigChangedBroadcastBlock = new BroadcastBlock <ConfigItemsCollection>(null);

            watcher.DataChanges.LinkTo(new ActionBlock <bool>(Refresh));
            Refresh(false).GetAwaiter().GetResult();
        }
Example #2
0
        public ConfigCache(IConfigItemsSource source, IConfigurationDataWatcher watcher, ILog log, IHealthMonitor healthMonitor)
        {
            Source = source;
            Log    = log;
            ConfigChangedBroadcastBlock = new BroadcastBlock <ConfigItemsCollection>(null);

            watcher.DataChanges.LinkTo(new ActionBlock <bool>(nothing => Refresh()));

            _healthMonitor = healthMonitor;
            _healthMonitor.SetHealthFunction(nameof(ConfigCache), HealthCheck);
            Refresh(false).GetAwaiter().GetResult();
        }