Fixes DataTypeCacheRefresher to be a Json cache refresher since it needs to refresh both by GUID and by Int Ids

This commit is contained in:
Shannon Deminick
2013-05-07 19:37:57 -10:00
parent 4b199a9166
commit 0cda994538
3 changed files with 145 additions and 26 deletions

View File

@@ -110,23 +110,59 @@ namespace Umbraco.Web.Cache
#region Data type cache
/// <summary>
/// Refreshes the cache amongst servers for a template
/// Refreshes the cache amongst servers for a data type
/// </summary>
/// <param name="dc"></param>
/// <param name="dataTypeId"></param>
public static void RefreshDataTypeCache(this DistributedCache dc, int dataTypeId)
/// <param name="dataType"></param>
public static void RefreshDataTypeCache(this DistributedCache dc, global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
{
dc.Refresh(new Guid(DistributedCache.DataTypeCacheRefresherId), dataTypeId);
if (dataType != null)
{
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
}
}
/// <summary>
/// Removes the cache amongst servers for a template
/// Removes the cache amongst servers for a data type
/// </summary>
/// <param name="dc"></param>
/// <param name="dataTypeId"></param>
public static void RemoveDataTypeCache(this DistributedCache dc, int dataTypeId)
/// <param name="dataType"></param>
public static void RemoveDataTypeCache(this DistributedCache dc, global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
{
dc.Remove(new Guid(DistributedCache.DataTypeCacheRefresherId), dataTypeId);
if (dataType != null)
{
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
}
}
/// <summary>
/// Refreshes the cache amongst servers for a data type
/// </summary>
/// <param name="dc"></param>
/// <param name="dataType"></param>
public static void RefreshDataTypeCache(this DistributedCache dc, IDataTypeDefinition dataType)
{
if (dataType != null)
{
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
}
}
/// <summary>
/// Removes the cache amongst servers for a data type
/// </summary>
/// <param name="dc"></param>
/// <param name="dataType"></param>
public static void RemoveDataTypeCache(this DistributedCache dc, IDataTypeDefinition dataType)
{
if (dataType != null)
{
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
}
}
#endregion