private DateTime GetCachedTime() { if (_cache.HasValue(CacheKeys.Entry)) { return(_cache.Get <DateTime>(CacheKeys.Entry)); } DateTime cacheEntry = DateTime.Now; _cache.Set(CacheKeys.Entry, cacheEntry); return(cacheEntry); }
public void OnActionExecuted(ActionExecutedContext context) { try { if ((context.Result as dynamic).StatusCode != 200) { return; } } catch (Exception) { // unused } string cacheKey = GetCacheKey(context.HttpContext.Request); _cache.Set(cacheKey, context, TimeSpan.FromMinutes(_numMinutes)); }
public void Set(string key, object value) { _cache.Set(key, value); }