private Dictionary <int, Region> GetRegions() { const string key = "RegionService__Regions"; var tags = new[] { _settingsService.GetSetting(SettingsTitles.REGIONS_CONTENT_ID) }; return(_cacheProvider.GetOrAdd(key, tags, _cachePeriod, LoadRegions)); }
public override string GetSetting(string title) { var key = string.Format("GetSetting_{0}", title); return(_cacheProvider.GetOrAdd(key, new[] { _settingsContentId.ToString() }, _cachePeriod, () => GetSettingValue(title), true, CacheItemPriority.NeverRemove)); }
public override string GetSetting(string title) { const string key = "AllQpSettings"; var allSettings = _cacheProvider.GetOrAdd(key, new[] { CacheTags.QP8.DB }, _cacheTimeSpan, GetAppSettings, true, CacheItemPriority.NeverRemove); return(allSettings.ContainsKey(title) ? allSettings[title] : null); }
private DefinitionsFields GetAllDefinitionsFields(bool isLive, int?definitionId) { string cacheKey = "AllDefinitionsFields" + isLive + definitionId; return(_cacheProvider.GetOrAdd( cacheKey, new[] { _prodDefContentId.ToString() }, TimeSpan.FromHours(3), () => GetDefinitionsFields(_contentDefinitionService.GetDefinitions(isLive).Where(x => !definitionId.HasValue || x.ContentId == definitionId)))); }
public string GetUrlForFileAttribute(int fieldId) { return(_cacheProvider.GetOrAdd($"DBConnectorProxy.GetUrlForFileAttribute_{fieldId}", CacheTags.Merge(CacheTags.QP8.Site, CacheTags.QP8.Field), TimeSpan.FromMinutes(10), () => { return GetConnector().GetUrlForFileAttribute(fieldId); })); }
public string GetProductStoreVersion(string language, string state) { var key = GetKey(language, state); var serviceVersion = _cacheProvider.GetOrAdd(key, _expiration, () => { var client = _configuration.GetElasticClient(language, state); var info = client.GetInfo().Result; var version = JObject.Parse(info).SelectToken("version.number").Value <string>(); return(version); }); return(MapVersion(serviceVersion)); }
public string GetStatusName(int statusId) { var dictionary = _cacheProvider.GetOrAdd( StatusCacheKey, new[] { CacheTags.QP8.Content, CacheTags.QP8.StatusType }, TimeSpan.FromHours(1), () => GetDictionary()); if (dictionary.TryGetValue(statusId, out string status)) { return(status); } else { return(null); } }
public override TModel[] GetArticles() { return(_cacheProvider.GetOrAdd("ContentProviderBase_" + CacheKey, GetTags(), _cacheTimeSpan, base.GetArticles, true, CacheItemPriority.NeverRemove)); }
public override IEnumerable <ElasticIndex> GetElasticIndices() { return(_cacheProvider.GetOrAdd("ElasticIndexes", _indexProvider.GetTags(), _cacheTimeSpan, _indexProvider.GetArticles, true, CacheItemPriority.NeverRemove)); }