Fixes: U4-2721 RuntimeCacheProvider is not cleared when data type changes and updates the repo factory to not use the InMemory cache provider since we should only ever use that for very very specific reasons since the memory can never auto-clear with that provider.
This commit is contained in:
@@ -54,7 +54,7 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
return new ContentTypeRepository(
|
||||
uow,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : InMemoryCacheProvider.Current,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
|
||||
new TemplateRepository(uow, NullCacheProvider.Current));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
return new DictionaryRepository(
|
||||
uow,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : InMemoryCacheProvider.Current,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
|
||||
CreateLanguageRepository(uow));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
return new LanguageRepository(
|
||||
uow,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : InMemoryCacheProvider.Current);
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current);
|
||||
}
|
||||
|
||||
public virtual IMediaRepository CreateMediaRepository(IDatabaseUnitOfWork uow)
|
||||
@@ -92,7 +92,7 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
return new MediaTypeRepository(
|
||||
uow,
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : InMemoryCacheProvider.Current);
|
||||
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current);
|
||||
}
|
||||
|
||||
public virtual IRelationRepository CreateRelationRepository(IDatabaseUnitOfWork uow)
|
||||
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Persistence
|
||||
|
||||
internal virtual IMemberTypeRepository CreateMemberTypeRepository(IDatabaseUnitOfWork uow)
|
||||
{
|
||||
return new MemberTypeRepository(uow, _disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : InMemoryCacheProvider.Current);
|
||||
return new MemberTypeRepository(uow, _disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current);
|
||||
}
|
||||
|
||||
internal virtual IEntityRepository CreateEntityRepository(IDatabaseUnitOfWork uow)
|
||||
|
||||
@@ -47,7 +47,9 @@ namespace Umbraco.Core.Services
|
||||
/// Get permissions set for user and specified node ids
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="nodeIds"></param>
|
||||
/// <param name="nodeIds">
|
||||
/// Specifiying nothing will return all user permissions for all nodes
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<EntityPermission> GetPermissions(IUser user, params int[] nodeIds);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Umbraco.Core.Cache;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
@@ -115,6 +116,16 @@ namespace Umbraco.Web.Cache
|
||||
{
|
||||
var payloads = DeserializeFromJsonPayload(jsonPayload);
|
||||
|
||||
//we need to clear the ContentType runtime cache since that is what caches the
|
||||
// db data type to store the value against and anytime a datatype changes, this also might change
|
||||
// we basically need to clear all sorts of runtime caches here because so many things depend upon a data type
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IContent));
|
||||
RuntimeCacheProvider.Current.Clear(typeof (IContentType));
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IMedia));
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IMediaType));
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IMember));
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IMemberType));
|
||||
|
||||
payloads.ForEach(payload =>
|
||||
{
|
||||
//clear both the Id and Unique Id cache since we cache both in the legacy classes :(
|
||||
|
||||
Reference in New Issue
Block a user