Files
Umbraco-CMS/src/Umbraco.Core/Sync/IServerMessenger.cs
Shannon Deminick e97a01c75c Fixes: #U4-1992 - Creates DictionaryCacheRefresher to ensure that all cache associated with the dictionary is updated amongst all
servers when it is changed/removed. Removes RemoveByJson as we only actually require RefreshByJson since we can put any sort of parameters
in a custom json string including whether it is a remove operation (if required)
2013-03-23 01:59:25 +06:00

85 lines
3.9 KiB
C#

using System;
using System.Collections.Generic;
using umbraco.interfaces;
namespace Umbraco.Core.Sync
{
/// <summary>
/// Defines a server messenger for server sync and distrubuted cache
/// </summary>
internal interface IServerMessenger
{
/// <summary>
/// Performs a refresh and sends along the JSON payload to each server
/// </summary>
/// <param name="servers"></param>
/// <param name="refresher"></param>
/// <param name="jsonPayload">
/// A pre-formatted custom json payload to be sent to the servers, the cache refresher will deserialize and use to refresh cache
/// </param>
void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, string jsonPayload);
/// <summary>
/// Performs a sync against all instance objects
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="servers">The servers to sync against</param>
/// <param name="refresher"></param>
/// <param name="getNumericId">A delegate to return the Id for each instance to be used to sync to other servers</param>
/// <param name="instances"></param>
void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances);
/// <summary>
/// Performs a sync against all instance objects
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="servers">The servers to sync against</param>
/// <param name="refresher"></param>
/// <param name="getGuidId">A delegate to return the Id for each instance to be used to sync to other servers</param>
/// <param name="instances"></param>
void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances);
/// <summary>
/// Removes the cache for the specified items
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="servers"></param>
/// <param name="refresher"></param>
/// <param name="getNumericId">A delegate to return the Id for each instance to be used to sync to other servers</param>
/// <param name="instances"></param>
void PerformRemove<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances);
/// <summary>
/// Removes the cache for the specified items
/// </summary>
/// <param name="servers"></param>
/// <param name="refresher"></param>
/// <param name="numericIds"></param>
void PerformRemove(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds);
/// <summary>
/// Performs a sync against all Ids
/// </summary>
/// <param name="servers">The servers to sync against</param>
/// <param name="refresher"></param>
/// <param name="numericIds"></param>
void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds);
/// <summary>
/// Performs a sync against all Ids
/// </summary>
/// <param name="servers">The servers to sync against</param>
/// <param name="refresher"></param>
/// <param name="guidIds"></param>
void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params Guid[] guidIds);
/// <summary>
/// Performs entire cache refresh for a specified refresher
/// </summary>
/// <param name="servers"></param>
/// <param name="refresher"></param>
void PerformRefreshAll(IEnumerable<IServerAddress> servers, ICacheRefresher refresher);
}
}