예제 #1
0
        public ScriptApplicationHostOptionsSetup(IConfiguration configuration, IOptionsMonitor <StandbyOptions> standbyOptions,
                                                 IOptionsMonitorCache <ScriptApplicationHostOptions> cache)
        {
            _cache          = cache ?? throw new ArgumentNullException(nameof(cache));
            _configuration  = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _standbyOptions = standbyOptions ?? throw new ArgumentNullException(nameof(standbyOptions));

            // If standby options change, invalidate this options cache.
            _standbyOptionsOnChangeSubscription = _standbyOptions.OnChange(o => _cache.Clear());
        }
예제 #2
0
 public ConfigureHttpClientOptionsFromCollection(IOptionsMonitor <HttpClientCollectionOptions> optionsSnapshot,
                                                 IOptionsMonitorCache <HttpClientOptions> cache)
 {
     _optionsSnapshot = optionsSnapshot;
     optionsSnapshot.OnChange((options, name) => { cache.Clear(); });
 }
예제 #3
0
 public void Reset()
 {
     _cache.Clear();
 }