public ReportResults GetReportData(ReportArgs args) { var cacheKey = args.GroupId.ToString() + "_" + args.AreForumsIncluded.ToString(); Func<ReportResults> innerMethod = () => _reportDataService.GetData(args); return _cacheWrapper.CacheWrap(innerMethod, cacheKey); }
public ReportResults GetData(ReportArgs args) { Thread.Sleep(5000); var results = new ReportResults(); results.TotalViews = _random.Next(1000); results.TotalThreads = _random.Next(1000); results.TotalUsers = _random.Next(1000); return results; }
public ReportResults GetReportData(ReportArgs args) { var cacheKey = args.GroupId.ToString() + "_" + args.AreForumsIncluded.ToString(); if (_cache.IsCached(cacheKey)) return (ReportResults) _cache.GetCacheValue(cacheKey); var result = _reportDataService.GetData(args); _cache.SetCacheValue(cacheKey, result); return result; }
public ActionResult Index(ReportViewModel model) { if (!ModelState.IsValid) return View(model); var args = new ReportArgs { GroupId = model.GroupId.Value, AreForumsIncluded = model.AreForumsIncluded.Value }; var report = _reportService.GetReportData(args); model.Results = report; ViewBag.CacheDebug = GetCacheDebug(); return View(model); }
public ReportResults GetReportData(ReportArgs args) { var cacheKey = args.GroupId.ToString() + "_" + args.AreForumsIncluded.ToString(); if(HttpContext.Current.Cache[cacheKey] != null) return (ReportResults)HttpContext.Current.Cache[cacheKey]; var result = _reportDataService.GetData(args); HttpContext.Current.Cache.Add(cacheKey, result, null, DateTime.Now.AddSeconds(30), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); return result; }
public ReportResults GetReportData(ReportArgs args) { return _reportDataService.GetData(args); }