public async Task <ConfigurationSourceResult <TValue> > GetAppSettingAsync <TValue>(string key, CancellationToken cancellationToken = default(CancellationToken))
        {
            var appsetting = (ConfigurationSourceResult <TValue>)_objectCache.Get(_cacheKeyCreator.CreateCacheKey(key));

            if (appsetting == null)
            {
                appsetting = await _innerSource.GetAppSettingAsync <TValue>(key, cancellationToken)
                             .ConfigureAwait(false);

                var cacheItemPolicy = _cacheItemPolicyFactory();
                _objectCache.Add(CreateCacheItem(key, appsetting), cacheItemPolicy);
            }

            return(appsetting);
        }
 public void WhenTryingToGetTheAppSettings()
 {
     _result = _source.GetAppSettingAsync <TValue>(_key).Result;
 }
Beispiel #3
0
        public async Task <ConfigurationSourceResult <TValue> > GetAppSettingAsync <TValue>(string key, CancellationToken cancellationToken = default(CancellationToken))
        {
            key = _keyFormatter.FormatKey(key);

            return(await _inner.GetAppSettingAsync <TValue>(key, cancellationToken).ConfigureAwait(false));
        }
Beispiel #4
0
        public void WhenTryingToGetTheAppSettings()
        {
            var key = new Fixture().Create <string>();

            _result = _source.GetAppSettingAsync <TValue>(key).Result;
        }