diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index 9f5df7c886..e38464f5df 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -220,9 +220,9 @@ namespace Umbraco.Core.Sync // FIXME not true if we're running on a background thread, assuming we can? var sql = new Sql().Select("*") - .From() + .From(_appContext.DatabaseContext.SqlSyntax) .Where(dto => dto.Id > _lastId) - .OrderBy(dto => dto.Id); + .OrderBy(dto => dto.Id, _appContext.DatabaseContext.SqlSyntax); var dtos = _appContext.DatabaseContext.Database.Fetch(sql); if (dtos.Count <= 0) return; @@ -294,7 +294,7 @@ namespace Umbraco.Core.Sync private void EnsureInstructions() { var sql = new Sql().Select("*") - .From() + .From(_appContext.DatabaseContext.SqlSyntax) .Where(dto => dto.Id == _lastId); var dtos = _appContext.DatabaseContext.Database.Fetch(sql); diff --git a/src/Umbraco.Web/Cache/DistributedCache.cs b/src/Umbraco.Web/Cache/DistributedCache.cs index 9788618bb5..27c30d89e8 100644 --- a/src/Umbraco.Web/Cache/DistributedCache.cs +++ b/src/Umbraco.Web/Cache/DistributedCache.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Linq; using Umbraco.Core; using Umbraco.Core.Sync; @@ -192,24 +193,27 @@ namespace Umbraco.Web.Cache public void RefreshAll(Guid factoryGuid) { if (factoryGuid == Guid.Empty) return; - RefreshAll(factoryGuid, true); + + ServerMessengerResolver.Current.Messenger.PerformRefreshAll( + ServerRegistrarResolver.Current.Registrar.Registrations, + GetRefresherById(factoryGuid)); } - /// - /// Notifies the distributed cache of a global invalidation for a specified . - /// - /// The unique identifier of the ICacheRefresher. - /// If true, all servers in the load balancing environment are notified; otherwise, - /// only the local server is notified. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is no longer in use and does not work as advertised, the allServers parameter doesnt have any affect for database server messengers, do not use!")] public void RefreshAll(Guid factoryGuid, bool allServers) { if (factoryGuid == Guid.Empty) return; - - ServerMessengerResolver.Current.Messenger.PerformRefreshAll( - allServers - ? ServerRegistrarResolver.Current.Registrar.Registrations - : Enumerable.Empty(), //this ensures it will only execute against the current server - GetRefresherById(factoryGuid)); + if (allServers) + { + RefreshAll(factoryGuid); + } + else + { + ServerMessengerResolver.Current.Messenger.PerformRefreshAll( + Enumerable.Empty(), + GetRefresherById(factoryGuid)); + } } /// diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs index fe5ba99eb5..66cb82ff7c 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs @@ -263,8 +263,8 @@ namespace Umbraco.Web.Cache public static void ClearAllMacroCacheOnCurrentServer(this DistributedCache dc) { - // NOTE: The 'false' ensure that it will only refresh on the current server, not post to all servers - dc.RefreshAll(DistributedCache.MacroCacheRefresherGuid, false); + var macroRefresher = CacheRefreshersResolver.Current.GetById(DistributedCache.MacroCacheRefresherGuid); + macroRefresher.RefreshAll(); } public static void RefreshMacroCache(this DistributedCache dc, IMacro macro) @@ -403,8 +403,8 @@ namespace Umbraco.Web.Cache public static void ClearDomainCacheOnCurrentServer(this DistributedCache dc) { - var key = RepositoryBase.GetCacheTypeKey(); - ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(key); + var domainRefresher = CacheRefreshersResolver.Current.GetById(DistributedCache.DomainCacheRefresherGuid); + domainRefresher.RefreshAll(); } #endregion