using System;
namespace Umbraco.Web.Cache
{
///
/// Extension methods for DistrubutedCache
///
public static class DistributedCacheExtensions
{
///
/// Refreshes the cache amongst servers for a template
///
///
///
public static void RefreshTemplateCache(this DistributedCache dc, int templateId)
{
dc.Refresh(new Guid(DistributedCache.TemplateRefresherId), templateId);
}
///
/// Removes the cache amongst servers for a template
///
///
///
public static void RemoveTemplateCache(this DistributedCache dc, int templateId)
{
dc.Remove(new Guid(DistributedCache.TemplateRefresherId), templateId);
}
///
/// Refreshes the cache amongst servers for all pages
///
///
public static void RefreshAllPageCache(this DistributedCache dc)
{
dc.RefreshAll(new Guid(DistributedCache.PageCacheRefresherId));
}
///
/// Refreshes the cache amongst servers for a page
///
///
///
public static void RefreshPageCache(this DistributedCache dc, int pageId)
{
dc.Refresh(new Guid(DistributedCache.PageCacheRefresherId), pageId);
}
///
/// Removes the cache amongst servers for a page
///
///
///
public static void RemovePageCache(this DistributedCache dc, int pageId)
{
dc.Remove(new Guid(DistributedCache.PageCacheRefresherId), pageId);
}
///
/// Refreshes the cache amongst servers for a member
///
///
///
public static void RefreshMemberCache(this DistributedCache dc, int memberId)
{
dc.Refresh(new Guid(DistributedCache.MemberCacheRefresherId), memberId);
}
///
/// Refreshes the cache amongst servers for a media item
///
///
///
public static void RefreshMediaCache(this DistributedCache dc, int mediaId)
{
dc.Refresh(new Guid(DistributedCache.MediaCacheRefresherId), mediaId);
}
///
/// Refreshes the cache amongst servers for a macro item
///
///
///
public static void RefreshMacroCache(this DistributedCache dc, int macroId)
{
dc.Refresh(new Guid(DistributedCache.MacroCacheRefresherId), macroId);
}
///
/// Removes the cache amongst servers for a macro item
///
///
///
public static void RemoveMacroCache(this DistributedCache dc, int macroId)
{
dc.Remove(new Guid(DistributedCache.MacroCacheRefresherId), macroId);
}
}
}