public static string GetLabel(string labelKey, string culture) { if (String.IsNullOrEmpty(labelKey)) { return String.Empty; } if (!labelKey.Contains(".")) { return String.Empty; } CacheManager cacheManager = new CacheManager(); var valueFromCache = cacheManager.GetCache(labelKey); if (valueFromCache == null) { AppConfigurationManager confManager = new AppConfigurationManager(); string LabelFamily = labelKey.Split('.')[0]; var familyLabels = confManager.GetLabelsByFamily(LabelFamily, culture); string labelValue = String.Empty; familyLabels.TryGetValue(labelKey, out labelValue); CacheManager cacheMger = new CacheManager(); cacheMger.SetCache(familyLabels); return labelValue; } else { return valueFromCache.ToString(); } }
public ActionResult FlushCache() { CacheManager cachMagr = new CacheManager(); var flushResult = cachMagr.Flush(); if (flushResult.Item1) { ViewBag.result = "OK"; } else { ViewBag.result = String.Format("Error: {0}",flushResult.Item2); } return View(); }