Renormalize
This commit is contained in:
@@ -1,54 +1,54 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Changes;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
public sealed class LanguageCacheRefresher : CacheRefresherBase<LanguageCacheRefresher>
|
||||
{
|
||||
public LanguageCacheRefresher(CacheHelper cacheHelper, IPublishedSnapshotService publishedSnapshotService, IDomainService domainService)
|
||||
: base(cacheHelper)
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
public sealed class LanguageCacheRefresher : CacheRefresherBase<LanguageCacheRefresher>
|
||||
{
|
||||
public LanguageCacheRefresher(CacheHelper cacheHelper, IPublishedSnapshotService publishedSnapshotService, IDomainService domainService)
|
||||
: base(cacheHelper)
|
||||
{
|
||||
_publishedSnapshotService = publishedSnapshotService;
|
||||
_domainService = domainService;
|
||||
}
|
||||
|
||||
#region Define
|
||||
|
||||
protected override LanguageCacheRefresher This => this;
|
||||
|
||||
}
|
||||
|
||||
#region Define
|
||||
|
||||
protected override LanguageCacheRefresher This => this;
|
||||
|
||||
public static readonly Guid UniqueId = Guid.Parse("3E0F95D8-0BE5-44B8-8394-2B8750B62654");
|
||||
private readonly IPublishedSnapshotService _publishedSnapshotService;
|
||||
private readonly IDomainService _domainService;
|
||||
|
||||
public override Guid RefresherUniqueId => UniqueId;
|
||||
|
||||
public override string Name => "Language Cache Refresher";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Refresher
|
||||
|
||||
public override void Refresh(int id)
|
||||
{
|
||||
public override Guid RefresherUniqueId => UniqueId;
|
||||
|
||||
public override string Name => "Language Cache Refresher";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Refresher
|
||||
|
||||
public override void Refresh(int id)
|
||||
{
|
||||
ClearAllIsolatedCacheByEntityType<ILanguage>();
|
||||
RefreshDomains(id);
|
||||
base.Refresh(id);
|
||||
}
|
||||
|
||||
public override void Remove(int id)
|
||||
{
|
||||
ClearAllIsolatedCacheByEntityType<ILanguage>();
|
||||
//if a language is removed, then all dictionary cache needs to be removed
|
||||
RefreshDomains(id);
|
||||
base.Refresh(id);
|
||||
}
|
||||
|
||||
public override void Remove(int id)
|
||||
{
|
||||
ClearAllIsolatedCacheByEntityType<ILanguage>();
|
||||
//if a language is removed, then all dictionary cache needs to be removed
|
||||
ClearAllIsolatedCacheByEntityType<IDictionaryItem>();
|
||||
RefreshDomains(id);
|
||||
base.Remove(id);
|
||||
}
|
||||
|
||||
base.Remove(id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void RefreshDomains(int langId)
|
||||
@@ -68,6 +68,6 @@ namespace Umbraco.Web.Cache
|
||||
// notify
|
||||
_publishedSnapshotService.Notify(assignedDomains.Select(x => new DomainCacheRefresher.JsonPayload(x.Id, DomainChangeTypes.Remove)).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user