Esempio n. 1
0
        /// <summary>
        /// When the page cache is refreshed, we'll check if any articulate root nodes were included in the refresh, if so we'll set a flag
        /// on the current request to rebuild the routes at the end of the request
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// This will also work for load balanced scenarios since this event executes on all servers
        /// </remarks>
        void PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, Umbraco.Core.Cache.CacheRefresherEventArgs e)
        {
            if (UmbracoContext.Current == null)
            {
                return;
            }

            switch (e.MessageType)
            {
            case MessageType.RefreshById:
            case MessageType.RemoveById:
                var item = UmbracoContext.Current.ContentCache.GetById((int)e.MessageObject);
                if (item != null && item.DocumentTypeAlias.InvariantEquals("Articulate"))
                {
                    //add the unpublished entities to the request cache
                    ApplicationContext.Current.ApplicationCache.RequestCache.GetCacheItem("articulate-refresh-routes", () => true);
                }
                break;

            case MessageType.RefreshByInstance:
            case MessageType.RemoveByInstance:
                var content = e.MessageObject as IContent;
                if (content == null)
                {
                    return;
                }
                if (content.ContentType.Alias.InvariantEquals("Articulate"))
                {
                    //add the unpublished entities to the request cache
                    UmbracoContext.Current.Application.ApplicationCache.RequestCache.GetCacheItem("articulate-refresh-routes", () => true);
                }
                break;
            }
        }
Esempio n. 2
0
 private static void DomainCacheRefresher_CacheUpdated(DomainCacheRefresher sender, Umbraco.Core.Cache.CacheRefresherEventArgs e)
 {
     //ensure routes are rebuilt
     ApplicationContext.Current.ApplicationCache.RequestCache.GetCacheItem("articulate-refresh-routes", () => true);
 }
Esempio n. 3
0
 private void ContentCacheRefresher_CacheUpdated(ContentCacheRefresher sender, Umbraco.Core.Cache.CacheRefresherEventArgs e)
 {
     Cache.Instance.RemoveByPrefix(typeof(CmsServiceCachedProxy).ToString());
 }
Esempio n. 4
0
        /// <summary>
        /// When the page cache is refreshed, we'll check if any articulate root nodes were included in the refresh, if so we'll set a flag
        /// on the current request to rebuild the routes at the end of the request
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// This will also work for load balanced scenarios since this event executes on all servers
        /// </remarks>
        private static void PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, Umbraco.Core.Cache.CacheRefresherEventArgs e)
        {
            if (UmbracoContext.Current == null)
            {
                return;
            }

            switch (e.MessageType)
            {
            case MessageType.RefreshById:
            case MessageType.RemoveById:
                var item = UmbracoContext.Current.ContentCache.GetById((int)e.MessageObject);
                if (item != null && item.DocumentTypeAlias.InvariantEquals("Articulate"))
                {
                    //ensure routes are rebuilt
                    ApplicationContext.Current.ApplicationCache.RequestCache.GetCacheItem("articulate-refresh-routes", () => true);
                }
                break;

            case MessageType.RefreshByInstance:
            case MessageType.RemoveByInstance:
                var content = e.MessageObject as IContent;
                if (content == null)
                {
                    return;
                }
                //TODO: There is a case when there are URL conflicts with Articulate data that when the other data is unpublished
                // we'd want to rebuild articulate routes, but not sure how to handle that and we don't want to rebuild everytime
                // something is unpublished
                if (content.ContentType.Alias.InvariantEquals("Articulate"))
                {
                    //ensure routes are rebuilt
                    ApplicationContext.Current.ApplicationCache.RequestCache.GetCacheItem("articulate-refresh-routes", () => true);
                }
                break;
            }
        }