예제 #1
0
        public void RemoveFromCache()
        {
            var htmlCacheKey   = GetCacheKey(RenderVersion.HTML);
            var mobileCacheKey = GetCacheKey(RenderVersion.Mobile);

            FileCacheHelper.RemoveFromCache(htmlCacheKey);
            RedisCacheHelper.RemoveFromCache(htmlCacheKey);
            ContextHelper.RemoveFromCache(htmlCacheKey);

            RedisCacheHelper.RemoveFromCache(mobileCacheKey);
            FileCacheHelper.RemoveFromCache(mobileCacheKey);
            ContextHelper.RemoveFromCache(mobileCacheKey);

            /*var language = this.Language;
             *
             * if(language == null && this.LanguageID > 0)
             * {
             *  language = LanguagesMapper.GetByID(this.LanguageID);
             * }*/

            var parents = GetAllParentMediaDetails(this.LanguageID).Where(i => i.ID != this.ID);

            foreach (var item in parents)
            {
                item.RemoveFromCache();
            }
        }
예제 #2
0
        public static Return ClearAllCache()
        {
            try
            {
                ContextHelper.ClearAllMemoryCache();
                FileCacheHelper.ClearAllCache();
                RedisCacheHelper.ClearAllCache();

                var webserviceRequests = FrameworkLibrary.WebserviceRequestsMapper.GetAll();

                foreach (var item in webserviceRequests)
                {
                    var context = BaseMapper.GetObjectFromContext(item);

                    if (context != null)
                    {
                        BaseMapper.DeleteObjectFromContext(context);
                    }
                }

                var returnObj = BaseMapper.SaveDataModel();

                return(BaseMapper.GenerateReturn());
            }
            catch (Exception ex)
            {
                return(BaseMapper.GenerateReturn(ex));
            }
        }
예제 #3
0
        public void SaveToRedisCache(RenderVersion renderVersion, string html)
        {
            if (HasDraft || HistoryVersionNumber != 0)
            {
                return;
            }

            var cacheKey = GetCacheKey(renderVersion);

            RedisCacheHelper.SaveToCache(cacheKey, html);
        }