U4-7285 Every server that reads a instruction from umbracoCacheInstruction will also write the same instruction to the database. Intentional ?
This commit is contained in:
@@ -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<CacheInstructionDto>()
|
||||
.From<CacheInstructionDto>(_appContext.DatabaseContext.SqlSyntax)
|
||||
.Where<CacheInstructionDto>(dto => dto.Id > _lastId)
|
||||
.OrderBy<CacheInstructionDto>(dto => dto.Id);
|
||||
.OrderBy<CacheInstructionDto>(dto => dto.Id, _appContext.DatabaseContext.SqlSyntax);
|
||||
|
||||
var dtos = _appContext.DatabaseContext.Database.Fetch<CacheInstructionDto>(sql);
|
||||
if (dtos.Count <= 0) return;
|
||||
@@ -294,7 +294,7 @@ namespace Umbraco.Core.Sync
|
||||
private void EnsureInstructions()
|
||||
{
|
||||
var sql = new Sql().Select("*")
|
||||
.From<CacheInstructionDto>()
|
||||
.From<CacheInstructionDto>(_appContext.DatabaseContext.SqlSyntax)
|
||||
.Where<CacheInstructionDto>(dto => dto.Id == _lastId);
|
||||
|
||||
var dtos = _appContext.DatabaseContext.Database.Fetch<CacheInstructionDto>(sql);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies the distributed cache of a global invalidation for a specified <see cref="ICacheRefresher"/>.
|
||||
/// </summary>
|
||||
/// <param name="factoryGuid">The unique identifier of the ICacheRefresher.</param>
|
||||
/// <param name="allServers">If true, all servers in the load balancing environment are notified; otherwise,
|
||||
/// only the local server is notified.</param>
|
||||
[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<IServerAddress>(), //this ensures it will only execute against the current server
|
||||
GetRefresherById(factoryGuid));
|
||||
if (allServers)
|
||||
{
|
||||
RefreshAll(factoryGuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerMessengerResolver.Current.Messenger.PerformRefreshAll(
|
||||
Enumerable.Empty<IServerAddress>(),
|
||||
GetRefresherById(factoryGuid));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<IDomain>();
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(key);
|
||||
var domainRefresher = CacheRefreshersResolver.Current.GetById(DistributedCache.DomainCacheRefresherGuid);
|
||||
domainRefresher.RefreshAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user