Class RefreshInstruction
Represents an instruction to refresh or remove items in a distributed cache.
Inheritance
Namespace: Umbraco.Cms.Core.Sync
Assembly: Umbraco.Core.dll
Syntax
[DataContract]
public class RefreshInstruction
Remarks
This class is serializable and used for distributed cache synchronization across servers.
Constructors
View SourceRefreshInstruction()
Initializes a new instance of the RefreshInstruction class.
Declaration
public RefreshInstruction()
Remarks
Need this public, parameter-less constructor so the web service messenger can de-serialize the instructions it receives.
RefreshInstruction(Guid, RefreshMethodType, Guid, int, string, string)
Initializes a new instance of the RefreshInstruction class.
Declaration
public RefreshInstruction(Guid refresherId, RefreshMethodType refreshType, Guid guidId, int intId, string jsonIds, string jsonPayload)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | refresherId | |
| RefreshMethodType | refreshType | |
| Guid | guidId | |
| int | intId | |
| string | jsonIds | |
| string | jsonPayload |
Remarks
Need this public one so it can be de-serialized - used by the Json thing otherwise, should use GetInstructions(...)
Properties
View SourceGuidId
Gets or sets the Guid data value.
Declaration
[DataMember]
public Guid GuidId { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
IntId
Gets or sets the int data value.
Declaration
[DataMember]
public int IntId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
JsonIdCount
Gets or sets the number of Ids contained in the JsonIds json value.
Declaration
public int JsonIdCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This is used to determine the instruction count per row.
JsonIds
Gets or sets the ids data value.
Declaration
[DataMember]
public string? JsonIds { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
JsonPayload
Gets or sets the payload data value.
Declaration
[DataMember]
public string? JsonPayload { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RefreshType
Gets or sets the refresh action type.
Declaration
[DataMember]
public RefreshMethodType RefreshType { get; set; }
Property Value
| Type | Description |
|---|---|
| RefreshMethodType |
RefresherId
Gets or sets the refresher unique identifier.
Declaration
[DataMember]
public Guid RefresherId { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
Methods
View SourceEquals(object?)
Declaration
public override bool Equals(object? other)
Parameters
| Type | Name | Description |
|---|---|---|
| object | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(RefreshInstruction)
Determines whether the specified RefreshInstruction is equal to this instance.
Declaration
protected bool Equals(RefreshInstruction other)
Parameters
| Type | Name | Description |
|---|---|---|
| RefreshInstruction | other | The instruction to compare with this instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
GetInstructions(ICacheRefresher, IJsonSerializer, MessageType, IEnumerable<object>?, Type?, string?)
Creates refresh instructions based on the specified message type and parameters.
Declaration
public static IEnumerable<RefreshInstruction> GetInstructions(ICacheRefresher refresher, IJsonSerializer jsonSerializer, MessageType messageType, IEnumerable<object>? ids, Type? idType, string? json)
Parameters
| Type | Name | Description |
|---|---|---|
| ICacheRefresher | refresher | The cache refresher that will handle the instruction. |
| IJsonSerializer | jsonSerializer | The JSON serializer for serializing IDs. |
| MessageType | messageType | The type of refresh message. |
| IEnumerable<object> | ids | The collection of IDs to refresh or remove. |
| Type | idType | The type of the IDs (int or Guid). |
| string | json | Optional JSON payload data. |
Returns
| Type | Description |
|---|---|
| IEnumerable<RefreshInstruction> | A collection of refresh instructions. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when idType is null for ID-based operations. |
| ArgumentOutOfRangeException | Thrown when messageType is not supported. |
Operators
View Sourceoperator ==(RefreshInstruction, RefreshInstruction)
Determines whether two RefreshInstruction instances are equal.
Declaration
public static bool operator ==(RefreshInstruction left, RefreshInstruction right)
Parameters
| Type | Name | Description |
|---|---|---|
| RefreshInstruction | left | The first instruction to compare. |
| RefreshInstruction | right | The second instruction to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(RefreshInstruction, RefreshInstruction)
Determines whether two RefreshInstruction instances are not equal.
Declaration
public static bool operator !=(RefreshInstruction left, RefreshInstruction right)
Parameters
| Type | Name | Description |
|---|---|---|
| RefreshInstruction | left | The first instruction to compare. |
| RefreshInstruction | right | The second instruction to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|