示例#1
0
        private IEnumerable <ConfigurationSettingModel> GetSettings()
        {
            IEnumerable <ConfigurationSettingModel> configs = _cache.Get(nameof(ConfigurationSettingModel)) as IEnumerable <ConfigurationSettingModel>;

            if (configs != null)
            {
                return(configs);
            }

            configs = configurationSettingsService.GetConfigs();

            _cache.CreateEntry(nameof(ConfigurationSettingModel));
            _cache.Set(nameof(ConfigurationSettingModel), configs, new MemoryCacheEntryOptions
            {
                SlidingExpiration = TimeSpan.FromMinutes(10)
            });

            return(configs);
        }
示例#2
0
        public IActionResult Get()
        {
            var settings = configurationSettingsService.GetConfigs();

            return(Ok(settings));
        }