diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuChangedHandler.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuChangedHandler.cs new file mode 100644 index 0000000000..1bef58fd9d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuChangedHandler.cs @@ -0,0 +1,31 @@ +using System.Threading.Tasks; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; + +namespace Volo.CmsKit.Menus +{ + public class MenuChangedHandler : + ILocalEventHandler>, + ILocalEventHandler>, + ITransientDependency + { + protected IDistributedCache DistributedCache { get; } + + public MenuChangedHandler(IDistributedCache distributedCache) + { + DistributedCache = distributedCache; + } + + public Task HandleEventAsync(EntityUpdatedEventData eventData) + { + return DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); + } + + public Task HandleEventAsync(EntityDeletedEventData eventData) + { + return DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuUpdatedHandler.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuUpdatedHandler.cs deleted file mode 100644 index 9db5bc4967..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Menus/MenuUpdatedHandler.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; - -namespace Volo.CmsKit.Menus -{ - public class MenuUpdatedHandler : ILocalEventHandler>, ITransientDependency - { - protected IDistributedCache DistributedCache { get; } - - public MenuUpdatedHandler(IDistributedCache distributedCache) - { - DistributedCache = distributedCache; - } - - public async Task HandleEventAsync(EntityUpdatedEventData eventData) - { - await DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); - } - } -} \ No newline at end of file