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