diff --git a/src/Umbraco.Web/Cache/MediaCacheRefresher.cs b/src/Umbraco.Web/Cache/MediaCacheRefresher.cs
index 9074e4856c..bd12261b44 100644
--- a/src/Umbraco.Web/Cache/MediaCacheRefresher.cs
+++ b/src/Umbraco.Web/Cache/MediaCacheRefresher.cs
@@ -7,6 +7,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
+using Umbraco.Core.Persistence.Caching;
using umbraco.interfaces;
using System.Linq;
@@ -155,6 +156,7 @@ namespace Umbraco.Web.Cache
payloads.ForEach(payload =>
{
+
//if there's no path, then just use id (this will occur on permanent deletion like emptying recycle bin)
if (payload.Path.IsNullOrWhiteSpace())
{
@@ -165,6 +167,12 @@ namespace Umbraco.Web.Cache
{
foreach (var idPart in payload.Path.Split(','))
{
+ int idPartAsInt;
+ if (int.TryParse(idPart, out idPartAsInt))
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IMedia), idPartAsInt);
+ }
+
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(
string.Format("{0}_{1}_True", CacheKeys.MediaCacheKey, idPart));
diff --git a/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs b/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs
index 765c591415..761ae53e7c 100644
--- a/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs
+++ b/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs
@@ -3,22 +3,16 @@ using System.Web.Script.Serialization;
using Umbraco.Core.Cache;
using Umbraco.Core.Models;
using System.Linq;
+using Umbraco.Core.Persistence.Caching;
using Umbraco.Core.Sync;
namespace Umbraco.Web.Cache
{
///
- /// A cache refresher used for non-published content, this is primarily to notify Examine indexes to update
+ /// A cache refresher used for non-published content, this is primarily to notify Examine indexes to update and to refresh the RuntimeCacheRefresher
///
public sealed class UnpublishedPageCacheRefresher : TypedCacheRefresherBase, IJsonCacheRefresher
{
-
- //NOTE: There is no functionality for this cache refresher, it is here simply to emit events on each server for which examine
- // binds to. We could put the Examine index functionality in here but we've kept it all in the ExamineEvents class so that all of
- // the logic is in one place. In the future we may put the examine logic in a cache refresher instead (that would make sense) but we'd
- // want to get this done before making more cache refreshers:
- // http://issues.umbraco.org/issue/U4-2633
-
protected override UnpublishedPageCacheRefresher Instance
{
get { return this; }
@@ -78,12 +72,48 @@ namespace Umbraco.Web.Cache
#endregion
+ public override void RefreshAll()
+ {
+ RuntimeCacheProvider.Current.Clear(typeof(IContent));
+ base.RefreshAll();
+ }
+
+ public override void Refresh(int id)
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
+ base.Refresh(id);
+ }
+
+ public override void Remove(int id)
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
+ base.Remove(id);
+ }
+
+
+ public override void Refresh(IContent instance)
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
+ base.Refresh(instance);
+ }
+
+ public override void Remove(IContent instance)
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
+ base.Remove(instance);
+ }
+
///
/// Implement the IJsonCacheRefresher so that we can bulk delete the cache based on multiple IDs for when the recycle bin is emptied
///
///
public void Refresh(string jsonPayload)
{
+ foreach (var payload in DeserializeFromJsonPayload(jsonPayload))
+ {
+ RuntimeCacheProvider.Current.Delete(typeof(IContent), payload.Id);
+ }
+
OnCacheUpdated(Instance, new CacheRefresherEventArgs(jsonPayload, MessageType.RefreshByJson));
}