Beispiel #1
0
        /// <summary>
        ///  博客缓存回调
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="reason"></param>
        private void ArticleCalendarsOnRemoveCallback(string key, object value, CacheItemRemovedReason reason)
        {
            DateTime now       = DateTime.Now;
            var      Calendars = SideHelper.GetSideArticleCalendars();
            object   obj       = CacheHelper.GetCacheValue(key);

            if (obj != null)
            {
                HttpRuntime.Cache.Remove(key);
            }
            CacheHelper.Insert("ArticleCalendars", Calendars, now.AddMinutes(CacheTime), ArticleCategoriesOnRemoveCallback);
        }
Beispiel #2
0
        public void ArticleCacheManager()
        {
            DateTime now        = DateTime.Now;
            object   Categories = CacheHelper.GetCacheValue("ArticleCategories");
            object   Calendars  = CacheHelper.GetCacheValue("ArticleCalendars");

            if (Categories == null || Calendars == null)
            {
                Categories = SideHelper.GetSideCategoryCategories();
                Calendars  = SideHelper.GetSideArticleCalendars();
                CacheHelper.Insert("ArticleCategories", Categories, now.AddMinutes(CacheTime), ArticleCategoriesOnRemoveCallback);
                CacheHelper.Insert("ArticleCalendars", Calendars, now.AddMinutes(CacheTime), ArticleCalendarsOnRemoveCallback);
            }
        }