Files
Umbraco-CMS/src/Umbraco.Core/Cache/UserCacheRefresher.cs
Mole bf41c2eeaa Netcore: Align namespaces (#9801)
* Rename Umbraco.Core namespace to Umbraco.Cms.Core

* Move extension methods in core project to Umbraco.Extensions

* Move extension methods in core project to Umbraco.Extensions

* Rename Umbraco.Examine namespace to Umbraco.Cms.Examine

* Move examine extensions to Umbraco.Extensions namespace

* Reflect changed namespaces in Builder and fix unit tests

* Adjust namespace in Umbraco.ModelsBuilder.Embedded

* Adjust namespace in Umbraco.Persistence.SqlCe

* Adjust namespace in Umbraco.PublishedCache.NuCache

* Align namespaces in Umbraco.Web.BackOffice

* Align namespaces in Umbraco.Web.Common

* Ensure that SqlCeSupport is still enabled after changing the namespace

* Align namespaces in Umbraco.Web.Website

* Align namespaces in Umbraco.Web.UI.NetCore

* Align namespaces in Umbraco.Tests.Common

* Align namespaces in Umbraco.Tests.UnitTests

* Align namespaces in Umbraco.Tests.Integration

* Fix errors caused by changed namespaces

* Fix integration tests

* Undo the Umbraco.Examine.Lucene namespace change

This breaks integration tests on linux, since the namespace wont exists there because it's only used on windows.

* Fix merge

* Fix Merge
2021-02-18 11:06:02 +01:00

50 lines
1.2 KiB
C#

using System;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Persistence.Repositories;
namespace Umbraco.Cms.Core.Cache
{
public sealed class UserCacheRefresher : CacheRefresherBase<UserCacheRefresher>
{
public UserCacheRefresher(AppCaches appCaches)
: base(appCaches)
{ }
#region Define
protected override UserCacheRefresher This => this;
public static readonly Guid UniqueId = Guid.Parse("E057AF6D-2EE6-41F4-8045-3694010F0AA6");
public override Guid RefresherUniqueId => UniqueId;
public override string Name => "User Cache Refresher";
#endregion
#region Refresher
public override void RefreshAll()
{
ClearAllIsolatedCacheByEntityType<IUser>();
base.RefreshAll();
}
public override void Refresh(int id)
{
Remove(id);
base.Refresh(id);
}
public override void Remove(int id)
{
var userCache = AppCaches.IsolatedCaches.Get<IUser>();
if (userCache)
userCache.Result.Clear(RepositoryCacheKeys.GetKey<IUser>(id));
base.Remove(id);
}
#endregion
}
}