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

20 lines
580 B
C#

namespace Yes.Application.Admins.Articles
{
public record ArticleUpdatedEvent(int ArticleId) : INotification;
public class ArticleUpdatedEventHandler(BlogDbContext db, IMemoryCache cache) : INotificationHandler<ArticleUpdatedEvent>
{
private readonly BlogDbContext _db = db;
private readonly IMemoryCache _cache = cache;
public async Task Handle(ArticleUpdatedEvent notification, CancellationToken cancellationToken)
{
var articleId = notification.ArticleId;
_cache.Remove("Archives");
}
}
}