コード例 #1
0
 public static void RemoveCache(string tableName, int channelId)
 {
     ListCache.Remove(channelId);
     ContentCache.Remove(channelId);
     CountCache.Clear(tableName);
     StlContentCache.ClearCache();
 }
コード例 #2
0
        public static void UpdateCache(SiteInfo siteInfo, ChannelInfo channelInfo, IContentInfo contentInfoToUpdate)
        {
            var dict = ContentCache.GetContentDict(channelInfo.Id);

            var contentInfo = GetContentInfo(siteInfo, channelInfo, contentInfoToUpdate.Id);

            if (contentInfo != null)
            {
                var isClearCache = contentInfo.IsTop != contentInfoToUpdate.IsTop;

                if (!isClearCache)
                {
                    var orderAttributeName =
                        ETaxisTypeUtils.GetContentOrderAttributeName(
                            ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType));
                    if (contentInfo.Get(orderAttributeName) != contentInfoToUpdate.Get(orderAttributeName))
                    {
                        isClearCache = true;
                    }
                }

                if (isClearCache)
                {
                    ListCache.Remove(channelInfo.Id);
                }
            }


            dict[contentInfoToUpdate.Id] = (ContentInfo)contentInfoToUpdate;

            StlContentCache.ClearCache();
        }
コード例 #3
0
        public static void UpdateCache(SiteInfo siteInfo, ChannelInfo channelInfo, ContentInfo contentInfoToUpdate)
        {
            var dict = ContentCache.GetContentDict(channelInfo.Id);

            var contentInfo = GetContentInfo(siteInfo, channelInfo, contentInfoToUpdate.Id);

            if (contentInfo != null)
            {
                if (ListCache.IsChanged(channelInfo, contentInfo, contentInfoToUpdate))
                {
                    ListCache.Remove(channelInfo.Id);
                }

                if (CountCache.IsChanged(contentInfo, contentInfoToUpdate))
                {
                    var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                    CountCache.Remove(tableName, contentInfo);
                    CountCache.Add(tableName, contentInfoToUpdate);
                }
            }

            dict[contentInfoToUpdate.Id] = contentInfoToUpdate;

            StlContentCache.ClearCache();
        }
コード例 #4
0
 public static void RemoveCache(int siteId, int channelId, string tableName)
 {
     RemoveListCache(siteId, channelId);
     ContentCache.Remove(channelId);
     CountCache.Clear(tableName);
     StlContentCache.ClearCache();
 }
コード例 #5
0
 public static void RemoveCacheBySiteId(string tableName, int siteId)
 {
     foreach (var channelId in ChannelManager.GetChannelIdList(siteId))
     {
         ListCache.Remove(channelId);
         ContentCache.Remove(channelId);
     }
     CountCache.Clear(tableName);
     StlContentCache.ClearCache();
 }
コード例 #6
0
        public static void UpdateCache(SiteInfo siteInfo, ChannelInfo channelInfo, ContentInfo contentInfo)
        {
            var dict = ContentCache.GetContentDict(channelInfo.Id);

            ListCache.Remove(channelInfo.Id);

            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);

            CountCache.Remove(tableName, contentInfo);
            CountCache.Add(tableName, contentInfo);

            dict[contentInfo.Id] = contentInfo;

            StlContentCache.ClearCache();
        }
コード例 #7
0
        public static void InsertCache(SiteInfo siteInfo, ChannelInfo channelInfo, ContentInfo contentInfo)
        {
            if (contentInfo.SourceId == SourceManager.Preview)
            {
                return;
            }

            var dict = ContentCache.GetContentDict(contentInfo.ChannelId);

            dict[contentInfo.Id] = contentInfo;

            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);

            CountCache.Add(tableName, contentInfo);

            StlContentCache.ClearCache();
        }
コード例 #8
0
        public static void InsertCache(SiteInfo siteInfo, ChannelInfo channelInfo, IContentInfo contentInfo)
        {
            if (contentInfo.SourceId == SourceManager.Preview)
            {
                return;
            }

            var contentIdList = ListCache.GetContentIdList(channelInfo.Id);

            if (ETaxisTypeUtils.Equals(ETaxisType.OrderByTaxisDesc, channelInfo.Additional.DefaultTaxisType))
            {
                contentIdList.Insert(0, contentInfo.Id);
            }
            else
            {
                ListCache.Remove(channelInfo.Id);
            }

            var dict = ContentCache.GetContentDict(contentInfo.ChannelId);

            dict[contentInfo.Id] = (ContentInfo)contentInfo;

            var tableName     = ChannelManager.GetTableName(siteInfo, channelInfo);
            var countInfoList = GetContentCountInfoList(tableName);
            var countInfo     = countInfoList.FirstOrDefault(x =>
                                                             x.SiteId == siteInfo.Id && x.ChannelId == channelInfo.Id &&
                                                             x.IsChecked == contentInfo.IsChecked.ToString() && x.CheckedLevel == contentInfo.CheckedLevel);

            if (countInfo != null)
            {
                countInfo.Count++;
            }

            StlContentCache.ClearCache();
            CountCache.Clear(tableName);
        }
コード例 #9
0
 public static void RemoveCountCache(string tableName)
 {
     CountCache.Clear(tableName);
     StlContentCache.ClearCache();
 }