Adds a constant id for the media distributed cache object,

adds extension method to DistrubutedCache to refresh the media cache,
Changes all distrubuted cache calls for media to use extension method.
This commit is contained in:
Shannon Deminick
2013-02-07 04:01:50 +06:00
parent a1c2352dca
commit 84bd89f00b
3 changed files with 13 additions and 4 deletions

View File

@@ -63,6 +63,16 @@ namespace Umbraco.Web.Cache
{
dc.Refresh(new Guid(DistributedCache.MemberCacheRefresherId), memberId);
}
/// <summary>
/// Refreshes the cache amongst servers for a media item
/// </summary>
/// <param name="dc"></param>
/// <param name="mediaId"></param>
public static void RefreshMediaCache(this DistributedCache dc, int mediaId)
{
dc.Refresh(new Guid(DistributedCache.MediaCacheRefresherId), mediaId);
}
}
/// <summary>
@@ -86,6 +96,7 @@ namespace Umbraco.Web.Cache
public const string TemplateRefresherId = "DD12B6A0-14B9-46e8-8800-C154F74047C8";
public const string PageCacheRefresherId = "27AB3022-3DFA-47b6-9119-5945BC88FD66";
public const string MemberCacheRefresherId = "E285DF34-ACDC-4226-AE32-C0CB5CF388DA";
public const string MediaCacheRefresherId = "B29286DD-2D40-4DDB-B325-681226589FEC";
#endregion

View File

@@ -9,7 +9,7 @@ namespace Umbraco.Web.Cache
public Guid UniqueIdentifier
{
get { return new Guid("B29286DD-2D40-4DDB-B325-681226589FEC"); }
get { return new Guid(DistributedCache.MediaCacheRefresherId); }
}
public string Name

View File

@@ -74,9 +74,7 @@ namespace Umbraco.Web
if (allServers && UmbracoSettings.UseDistributedCalls)
{
DistributedCache.Instance.Refresh(
new Guid("B29286DD-2D40-4DDB-B325-681226589FEC"),
mediaId);
DistributedCache.Instance.RefreshMediaCache(mediaId);
}
else
{