Пример #1
0
 private void PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, CacheRefresherEventArgs e)
 {
     if (e.MessageType == MessageType.RefreshByInstance && e.MessageObject is IContent instance)
     {
         GuidToIdCache.TryAdd(instance);
     }
 }
Пример #2
0
 private void UnpublishedPageCacheRefresher_CacheUpdated(UnpublishedPageCacheRefresher sender, CacheRefresherEventArgs e)
 {
     if (e.MessageType == MessageType.RemoveByInstance && e.MessageObject is IContent instance)
     {
         GuidToIdCache.TryRemove(instance);
     }
 }
Пример #3
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            // Build the mapping from Udi to Id on start-up.
            GuidToIdCache.BuildCache(applicationContext.DatabaseContext);

            // On content cache refresh, update the mappings.
            PageCacheRefresher.CacheUpdated            += PageCacheRefresher_CacheUpdated;
            UnpublishedPageCacheRefresher.CacheUpdated += UnpublishedPageCacheRefresher_CacheUpdated;
        }