removes LegacyTransientObjectsResolver (no longer needed), makes CacheRefreshersResolver into a container resolver so we can ctor inject into them (these should NOT be transient instances), Fixes more extension methods that rely on ApplicationContext.Current which exposes a few issues like DescendantsAndSelf since that was only getting them for content types!

This commit is contained in:
Shannon
2016-05-18 18:12:41 +02:00
parent 885595b1e6
commit f51a98435f
10 changed files with 114 additions and 160 deletions

View File

@@ -304,13 +304,15 @@ namespace Umbraco.Web.Cache
public static void RefreshContentTypeCache(this DistributedCache dc, IContentType contentType)
{
if (contentType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(false, contentType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(false, contentType));
}
public static void RemoveContentTypeCache(this DistributedCache dc, IContentType contentType)
{
if (contentType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(true, contentType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(true, contentType));
}
#endregion
@@ -320,13 +322,15 @@ namespace Umbraco.Web.Cache
public static void RefreshMediaTypeCache(this DistributedCache dc, IMediaType mediaType)
{
if (mediaType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(false, mediaType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(false, mediaType));
}
public static void RemoveMediaTypeCache(this DistributedCache dc, IMediaType mediaType)
{
if (mediaType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(true, mediaType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(true, mediaType));
}
#endregion
@@ -336,13 +340,15 @@ namespace Umbraco.Web.Cache
public static void RefreshMemberTypeCache(this DistributedCache dc, IMemberType memberType)
{
if (memberType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(false, memberType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(false, memberType));
}
public static void RemoveMemberTypeCache(this DistributedCache dc, IMemberType memberType)
{
if (memberType == null) return;
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, ContentTypeCacheRefresher.SerializeToJsonPayload(true, memberType));
var contentTypeCacheRefresher = (ContentTypeCacheRefresher)CacheRefreshersResolver.Current.GetById(DistributedCache.ContentTypeCacheRefresherGuid);
dc.RefreshByJson(DistributedCache.ContentTypeCacheRefresherGuid, contentTypeCacheRefresher.SerializeToJsonPayload(true, memberType));
}
#endregion