Class ServerMessengerBase
Provides a base class for all IServerMessenger implementations.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Sync
Assembly: Umbraco.Infrastructure.dll
Syntax
public abstract class ServerMessengerBase : IServerMessenger
Constructors
View SourceServerMessengerBase(Boolean)
Initializes a new instance of the ServerMessengerBase class.
Declaration
protected ServerMessengerBase(bool distributedEnabled)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | distributedEnabled | If set to |
Properties
View SourceDistributedEnabled
Gets or sets a value indicating whether distributed calls are made when messaging a cache refresher.
Declaration
protected bool DistributedEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
View SourceDeliver(ICacheRefresher, MessageType, Nullable<IEnumerable<Object>>, String)
Declaration
protected virtual void Deliver(ICacheRefresher refresher, MessageType messageType, IEnumerable<object>? ids = null, string json = null)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
MessageType | messageType | |
System.Nullable<IEnumerable<System.Object>> | ids | |
System.String | json |
Deliver<TPayload>(ICacheRefresher, TPayload[])
Declaration
protected virtual void Deliver<TPayload>(ICacheRefresher refresher, TPayload[] payload)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
TPayload[] | payload |
Type Parameters
Name | Description |
---|---|
TPayload |
Deliver<T>(ICacheRefresher, MessageType, Func<T, Object>, IEnumerable<T>)
Declaration
protected virtual void Deliver<T>(ICacheRefresher refresher, MessageType messageType, Func<T, object> getId, IEnumerable<T> instances)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
MessageType | messageType | |
Func<T, System.Object> | getId | |
IEnumerable<T> | instances |
Type Parameters
Name | Description |
---|---|
T |
DeliverLocal(ICacheRefresher, MessageType, Nullable<IEnumerable<Object>>, String)
Executes the non-strongly typed ICacheRefresher on the local/current server.
Declaration
protected void DeliverLocal(ICacheRefresher refresher, MessageType messageType, IEnumerable<object>? ids = null, string json = null)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The cache refresher. |
MessageType | messageType | The message type. |
System.Nullable<IEnumerable<System.Object>> | ids | The IDs. |
System.String | json | The JSON. |
Remarks
Since this is only for non strongly typed ICacheRefresher, it will throw for message types that are by instance.
DeliverLocal<TPayload>(ICacheRefresher, TPayload[])
Declaration
protected void DeliverLocal<TPayload>(ICacheRefresher refresher, TPayload[] payload)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
TPayload[] | payload |
Type Parameters
Name | Description |
---|---|
TPayload |
DeliverLocal<T>(ICacheRefresher, MessageType, Func<T, Object>, IEnumerable<T>)
Executes the strongly typed ICacheRefresher<T> on the local/current server.
Declaration
protected void DeliverLocal<T>(ICacheRefresher refresher, MessageType messageType, Func<T, object> getId, IEnumerable<T> instances)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The cache refresher. |
MessageType | messageType | The message type. |
Func<T, System.Object> | getId | The function that gets the IDs from the instance. |
IEnumerable<T> | instances | The instances. |
Type Parameters
Name | Description |
---|---|
T | The cache refresher instance type. |
Remarks
Since this is only for strongly typed ICacheRefresher<T>, it will throw for message types that are not by instance.
DeliverRemote(ICacheRefresher, MessageType, Nullable<IEnumerable<Object>>, String)
Declaration
protected abstract void DeliverRemote(ICacheRefresher refresher, MessageType messageType, IEnumerable<object>? ids = null, string json = null)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
MessageType | messageType | |
System.Nullable<IEnumerable<System.Object>> | ids | |
System.String | json |
GetArrayType(Nullable<IEnumerable<Object>>, out Nullable<Type>)
Declaration
protected static bool GetArrayType(IEnumerable<object>? ids, out Type? arrayType)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<IEnumerable<System.Object>> | ids | |
System.Nullable<Type> | arrayType |
Returns
Type | Description |
---|---|
System.Boolean |
PerformRefresh(ICacheRefresher, String)
Declaration
public void PerformRefresh(ICacheRefresher refresher, string jsonPayload)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
System.String | jsonPayload |
QueueRefresh(ICacheRefresher, Guid[])
Declaration
public void QueueRefresh(ICacheRefresher refresher, params Guid[] guidIds)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
Guid[] | guidIds |
QueueRefresh(ICacheRefresher, Int32[])
Notifies all servers of specified items invalidation, for a specified ICacheRefresher.
Declaration
public void QueueRefresh(ICacheRefresher refresher, params int[] numericIds)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The ICacheRefresher. |
System.Int32[] | numericIds | The unique identifiers of the invalidated items. |
QueueRefresh<TPayload>(ICacheRefresher, TPayload[])
Notifies the distributed cache, for a specified ICacheRefresher.
Declaration
public void QueueRefresh<TPayload>(ICacheRefresher refresher, TPayload[] payload)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The ICacheRefresher. |
TPayload[] | payload | The notification content. |
Type Parameters
Name | Description |
---|---|
TPayload |
QueueRefresh<T>(ICacheRefresher, Func<T, Guid>, T[])
Declaration
public void QueueRefresh<T>(ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
Func<T, Guid> | getGuidId | |
T[] | instances |
Type Parameters
Name | Description |
---|---|
T |
QueueRefresh<T>(ICacheRefresher, Func<T, Int32>, T[])
Declaration
public void QueueRefresh<T>(ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
Func<T, System.Int32> | getNumericId | |
T[] | instances |
Type Parameters
Name | Description |
---|---|
T |
QueueRefreshAll(ICacheRefresher)
Notifies all servers of a global invalidation for a specified ICacheRefresher.
Declaration
public void QueueRefreshAll(ICacheRefresher refresher)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The ICacheRefresher. |
QueueRemove(ICacheRefresher, Int32[])
Notifies all servers of specified items removal, for a specified ICacheRefresher.
Declaration
public void QueueRemove(ICacheRefresher refresher, params int[] numericIds)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The ICacheRefresher. |
System.Int32[] | numericIds | The unique identifiers of the removed items. |
QueueRemove<T>(ICacheRefresher, Func<T, Int32>, T[])
Declaration
public void QueueRemove<T>(ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | |
Func<T, System.Int32> | getNumericId | |
T[] | instances |
Type Parameters
Name | Description |
---|---|
T |
RequiresDistributed(ICacheRefresher, MessageType)
Determines whether to make distributed calls when messaging a cache refresher.
Declaration
protected virtual bool RequiresDistributed(ICacheRefresher refresher, MessageType messageType)
Parameters
Type | Name | Description |
---|---|---|
ICacheRefresher | refresher | The cache refresher. |
MessageType | messageType | The message type. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SendMessages()
Called to send/commit the queued messages created with the Perform methods
Declaration
public abstract void SendMessages()
Sync()
Called to synchronize a server with queued notifications
Declaration
public abstract void Sync()