Streamlines how macro cache is handled
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
using umbraco;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
@@ -159,6 +160,19 @@ namespace Umbraco.Web.Cache
|
||||
dc.Refresh(new Guid(DistributedCache.MacroCacheRefresherId), macroId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the cache amongst servers for a macro item
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="macro"></param>
|
||||
public static void RefreshMacroCache(this DistributedCache dc, global::umbraco.cms.businesslogic.macro.Macro macro)
|
||||
{
|
||||
if (macro != null)
|
||||
{
|
||||
dc.Refresh(new Guid(DistributedCache.MacroCacheRefresherId), macro1 => macro1.Id, macro);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cache amongst servers for a macro item
|
||||
/// </summary>
|
||||
@@ -168,5 +182,31 @@ namespace Umbraco.Web.Cache
|
||||
{
|
||||
dc.Remove(new Guid(DistributedCache.MacroCacheRefresherId), macroId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cache amongst servers for a macro item
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="macro"></param>
|
||||
public static void RemoveMacroCache(this DistributedCache dc, macro macro)
|
||||
{
|
||||
if (macro != null && macro.Model != null)
|
||||
{
|
||||
dc.Remove(new Guid(DistributedCache.MacroCacheRefresherId), macro1 => macro1.Model.Id, macro);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cache amongst servers for a macro item
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="macro"></param>
|
||||
public static void RemoveMacroCache(this DistributedCache dc, global::umbraco.cms.businesslogic.macro.Macro macro)
|
||||
{
|
||||
if (macro != null)
|
||||
{
|
||||
dc.Remove(new Guid(DistributedCache.MacroCacheRefresherId), macro1 => macro1.Id, macro);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user