diff --git a/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs b/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs index 1fb49ee9df..c9c4300c71 100644 --- a/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs +++ b/src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs @@ -75,12 +75,12 @@ namespace Umbraco.Web.Cache static void MemberBeforeDelete(Member sender, DeleteEventArgs e) { - ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember(sender.Id); + DistributedCache.Instance.RefreshMemberCache(sender.Id); } static void MemberAfterSave(Member sender, SaveEventArgs e) { - ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember(sender.Id); + DistributedCache.Instance.RefreshMemberCache(sender.Id); } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Cache/MemberLibraryRefreshers.cs b/src/Umbraco.Web/Cache/MemberCacheRefresher.cs similarity index 65% rename from src/Umbraco.Web/Cache/MemberLibraryRefreshers.cs rename to src/Umbraco.Web/Cache/MemberCacheRefresher.cs index d94d90322f..18bb9f3e3e 100644 --- a/src/Umbraco.Web/Cache/MemberLibraryRefreshers.cs +++ b/src/Umbraco.Web/Cache/MemberCacheRefresher.cs @@ -4,7 +4,7 @@ using umbraco.interfaces; namespace Umbraco.Web.Cache { - public class MemberLibraryRefreshers : ICacheRefresher + public class MemberCacheRefresher : ICacheRefresher { public Guid UniqueIdentifier @@ -23,7 +23,10 @@ namespace Umbraco.Web.Cache public void Refresh(int id) { - ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember(id, false); + const string getmemberCacheKey = "GetMember"; + + ApplicationContext.Current.ApplicationCache. + ClearCacheByKeySearch(string.Format("UL_{0}_{1}", getmemberCacheKey, id)); } public void Remove(int id) diff --git a/src/Umbraco.Web/CacheHelperExtensions.cs b/src/Umbraco.Web/CacheHelperExtensions.cs index f5598b9453..84aa3012ba 100644 --- a/src/Umbraco.Web/CacheHelperExtensions.cs +++ b/src/Umbraco.Web/CacheHelperExtensions.cs @@ -94,32 +94,6 @@ namespace Umbraco.Web } } } - } - - /// - /// Clears the library cache for members - /// - /// - /// - /// - /// If set to false, this will only clear the library cache for the current server, not all servers registered in the - /// server farm. In most cases if you are clearing cache you would probably clear it on all servers. - /// - public static void ClearLibraryCacheForMember(this CacheHelper cacheHelper, int memberId, bool allServers = true) - { - const string getmemberCacheKey = "GetMember"; - - if (allServers && UmbracoSettings.UseDistributedCalls) - { - DistributedCache.Instance.RefreshMemberCache(memberId); - } - else - { - cacheHelper.ClearCacheByKeySearch( - string.Format("UL_{0}_{1}", getmemberCacheKey, memberId)); - } - - } /// diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 23f525464b..8388ed97e9 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -250,7 +250,7 @@ - + diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index bb0ae99c03..fe2bb93688 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -1864,13 +1864,13 @@ namespace umbraco [Obsolete("Use ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember instead")] public static void ClearLibraryCacheForMember(int mediaId) { - ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember(mediaId); + DistributedCache.Instance.RefreshMemberCache(mediaId); } [Obsolete("Use ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember with the allServers flag set to false instead")] public static void ClearLibraryCacheForMemberDo(int memberId) { - ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMember(memberId, false); + DistributedCache.Instance.RefreshMemberCache(memberId); } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/cache/LegacyClasses.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/cache/LegacyClasses.cs index 256fa59569..e05488bb7f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/cache/LegacyClasses.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/cache/LegacyClasses.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.cache } [Obsolete("This class is no longer used, use Umbraco.Web.Cache.MemberLibraryRefreshers instead")] - public class MemberLibraryRefreshers : Umbraco.Web.Cache.MemberLibraryRefreshers + public class MemberLibraryRefreshers : Umbraco.Web.Cache.MemberCacheRefresher { }