Files
yes.blog/Yes.Application/Admins/Pages/PageUpdatedEventHandler.cs
2025-04-30 09:51:36 +08:00

20 lines
563 B
C#

namespace Yes.Application.Admins.Pages
{
public record PageUpdatedEvent(int PageId) : INotification;
public class PageUpdatedEventHandler(BlogDbContext db, IMemoryCache cache) : INotificationHandler<PageUpdatedEvent>
{
private readonly BlogDbContext _db = db;
private readonly IMemoryCache _cache = cache;
public async Task Handle(PageUpdatedEvent notification, CancellationToken cancellationToken)
{
var pageId = notification.PageId;
_cache.Remove($"SinglePages_10");
}
}
}