refresh cache if user is updated

This commit is contained in:
sbwalker 2024-02-26 14:54:59 -05:00
parent 2ed593c5e0
commit 6fbe459903

View File

@ -21,8 +21,13 @@ namespace Oqtane.Infrastructure.EventSubscribers
{ {
_cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.EntityId}*", true); _cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.EntityId}*", true);
} }
// when user is modified (ie. roles) a a site reload event is raised and the site cache item for the user needs to be refreshed
if (syncEvent.EntityName == EntityNames.User && syncEvent.Action == SyncEventActions.Reload)
{
_cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.SiteId}:{syncEvent.EntityId}", true);
}
// when a site entity is updated the hosting model may have changed, so the client assemblies cache items need to be refreshed // when a site entity is updated, the hosting model may have changed so the client assemblies cache items need to be refreshed
if (syncEvent.EntityName == EntityNames.Site && syncEvent.Action == SyncEventActions.Update) if (syncEvent.EntityName == EntityNames.Site && syncEvent.Action == SyncEventActions.Update)
{ {
_cache.Remove($"assemblieslist:{syncEvent.TenantId}:{syncEvent.EntityId}"); _cache.Remove($"assemblieslist:{syncEvent.TenantId}:{syncEvent.EntityId}");