From ecadb918f239dd84e377e678b47aae34f4a745fe Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 8 Jun 2016 14:03:33 +0200 Subject: [PATCH] Cleanup - no more stylesheet cache refresher --- .../Cache/CacheRefresherEventHandler.cs | 40 ++----------------- src/Umbraco.Web/Cache/DistributedCache.cs | 8 ---- .../Cache/DistributedCacheExtensions.cs | 40 ------------------- 3 files changed, 4 insertions(+), 84 deletions(-) diff --git a/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs b/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs index 91b358eb9b..43388b54f5 100644 --- a/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs +++ b/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs @@ -1,12 +1,10 @@ using System; -using System.Collections.Generic; using Umbraco.Core; using Umbraco.Core.Events; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Services; -using umbraco.BusinessLogic; using System.Linq; using Umbraco.Core.Logging; using Umbraco.Core.Services.Changes; @@ -54,8 +52,8 @@ namespace Umbraco.Web.Cache DataTypeService.Saved += DataTypeServiceSaved; // bind to stylesheet events - FileService.SavedStylesheet += FileServiceSavedStylesheet; - FileService.DeletedStylesheet += FileServiceDeletedStylesheet; + //FileService.SavedStylesheet += FileServiceSavedStylesheet; + //FileService.DeletedStylesheet += FileServiceDeletedStylesheet; // bind to domain events DomainService.Saved += DomainServiceSaved; @@ -127,8 +125,8 @@ namespace Umbraco.Web.Cache DataTypeService.Saved -= DataTypeServiceSaved; // bind to stylesheet events - FileService.SavedStylesheet -= FileServiceSavedStylesheet; - FileService.DeletedStylesheet -= FileServiceDeletedStylesheet; + //FileService.SavedStylesheet -= FileServiceSavedStylesheet; + //FileService.DeletedStylesheet -= FileServiceDeletedStylesheet; // bind to domain events DomainService.Saved -= DomainServiceSaved; @@ -322,20 +320,6 @@ namespace Umbraco.Web.Cache #endregion - #region FileService / StyleSheets - - static void FileServiceDeletedStylesheet(IFileService sender, DeleteEventArgs e) - { - e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveStylesheetCache(x)); - } - - static void FileServiceSavedStylesheet(IFileService sender, SaveEventArgs e) - { - e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshStylesheetCache(x)); - } - - #endregion - #region DomainService static void DomainServiceSaved(IDomainService sender, SaveEventArgs e) @@ -410,22 +394,6 @@ namespace Umbraco.Web.Cache e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveUserCache(x.Id)); } - private static void InvalidateCacheForPermissionsChange(UserPermission sender) - { - if (sender.User != null) - { - DistributedCache.Instance.RefreshUserPermissionsCache(sender.User.Id); - } - else if (sender.UserId > -1) - { - DistributedCache.Instance.RefreshUserPermissionsCache(sender.UserId); - } - else if (sender.NodeIds.Any()) - { - DistributedCache.Instance.RefreshAllUserPermissionsCache(); - } - } - #endregion #region FileService / Template diff --git a/src/Umbraco.Web/Cache/DistributedCache.cs b/src/Umbraco.Web/Cache/DistributedCache.cs index f05798d54e..5d7e50c01b 100644 --- a/src/Umbraco.Web/Cache/DistributedCache.cs +++ b/src/Umbraco.Web/Cache/DistributedCache.cs @@ -21,14 +21,6 @@ namespace Umbraco.Web.Cache /// public sealed class DistributedCache { - #region Public constants/Ids - - // fixme ALL THIS MUST MOVE TO THE REFRESHERS - public static readonly Guid StylesheetCacheRefresherGuid = new Guid("E0633648-0DEB-44AE-9A48-75C3A55CB670"); - public static readonly Guid StylesheetPropertyCacheRefresherGuid = new Guid("2BC7A3A4-6EB1-4FBC-BAA3-C9E7B6D36D38"); - - #endregion - #region Constructor & Singleton // note - should inject into the application instead of using a singleton diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs index b459ad9895..a95f9edbc7 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs @@ -311,46 +311,6 @@ namespace Umbraco.Web.Cache #endregion - #region Stylesheet Cache - - public static void RefreshStylesheetPropertyCache(this DistributedCache dc, global::umbraco.cms.businesslogic.web.StylesheetProperty styleSheetProperty) - { - if (styleSheetProperty == null) return; - dc.Refresh(DistributedCache.StylesheetPropertyCacheRefresherGuid, styleSheetProperty.Id); - } - - public static void RemoveStylesheetPropertyCache(this DistributedCache dc, global::umbraco.cms.businesslogic.web.StylesheetProperty styleSheetProperty) - { - if (styleSheetProperty == null) return; - dc.Remove(DistributedCache.StylesheetPropertyCacheRefresherGuid, styleSheetProperty.Id); - } - - public static void RefreshStylesheetCache(this DistributedCache dc, StyleSheet styleSheet) - { - if (styleSheet == null) return; - dc.Refresh(DistributedCache.StylesheetCacheRefresherGuid, styleSheet.Id); - } - - public static void RemoveStylesheetCache(this DistributedCache dc, StyleSheet styleSheet) - { - if (styleSheet == null) return; - dc.Remove(DistributedCache.StylesheetCacheRefresherGuid, styleSheet.Id); - } - - public static void RefreshStylesheetCache(this DistributedCache dc, Umbraco.Core.Models.Stylesheet styleSheet) - { - if (styleSheet == null) return; - dc.Refresh(DistributedCache.StylesheetCacheRefresherGuid, styleSheet.Id); - } - - public static void RemoveStylesheetCache(this DistributedCache dc, Umbraco.Core.Models.Stylesheet styleSheet) - { - if (styleSheet == null) return; - dc.Remove(DistributedCache.StylesheetCacheRefresherGuid, styleSheet.Id); - } - - #endregion - #region Domain Cache public static void RefreshDomainCache(this DistributedCache dc, IDomain domain)