Exemple #1
0
        /// <summary>
        /// Invalidates the current record from the cache.
        /// </summary>
        /// <param name="record">The record</param>
        public void InvalidateRecord(Page record)
        {
            if (Cache.ContainsKey(record.Id))
            {
                Cache.Remove(record.Id);
            }
            // If we click save & publish right away the permalink is not created yet.
            if (record.Permalink != null && PermalinkCache.ContainsKey(record.Permalink))
            {
                PermalinkCache.Remove(record.Permalink);
            }
            if (record.Permalink != null && PermalinkIdCache.ContainsKey(record.PermalinkId))
            {
                PermalinkIdCache.Remove(record.PermalinkId);
            }
            if (record.IsStartpage && Cache.ContainsKey(Guid.Empty))
            {
                Cache.Remove(Guid.Empty);
            }

            // Invalidate public sitemap
            if (!record.IsDraft)
            {
                Sitemap.InvalidateCache();
            }
        }
Exemple #2
0
        /// <summary>
        /// Invalidates the current record from the cache.
        /// </summary>
        /// <param name="record">The record</param>
        public void InvalidateRecord(Page record)
        {
            Application.Current.CacheProvider.Remove(record.Id.ToString());

            // If we click save & publish right away the permalink is not created yet.
            if (record.Permalink != null && PermalinkCache.ContainsKey(record.SiteTreeId) && PermalinkCache[record.SiteTreeId].ContainsKey(record.Permalink))
            {
                PermalinkCache[record.SiteTreeId].Remove(record.Permalink);
            }
            if (record.Permalink != null && PermalinkIdCache.ContainsKey(record.PermalinkId))
            {
                PermalinkIdCache.Remove(record.PermalinkId);
            }
            if (record.IsStartpage)
            {
                InvalidateStartpage(record.SiteTreeId);
            }

            // Invalidate public sitemap
            if (!record.IsDraft)
            {
                Sitemap.InvalidateCache(record.SiteTreeInternalId);
            }
        }