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);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
 public void Set(string key, object value)
 {
     _cache.Set(key, value);
 }