improve caching for static rendering

This commit is contained in:
sbwalker
2024-02-26 14:28:38 -05:00
parent 553bbda769
commit aac4d3eefb
3 changed files with 89 additions and 5 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.Caching.Memory;
using Oqtane.Extensions;
using Oqtane.Models;
using Oqtane.Shared;
@ -18,7 +19,7 @@ namespace Oqtane.Infrastructure.EventSubscribers
// when site entities change (ie. site, pages, modules, etc...) a site refresh event is raised and the site cache item needs to be refreshed
if (syncEvent.EntityName == EntityNames.Site && syncEvent.Action == SyncEventActions.Refresh)
{
_cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.EntityId}");
_cache.Remove($"site:{syncEvent.TenantId}:{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