mirror of https://github.com/abpframework/abp.git
2 changed files with 31 additions and 23 deletions
@ -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<EntityUpdatedEventData<Menu>>, |
|||
ILocalEventHandler<EntityDeletedEventData<Menu>>, |
|||
ITransientDependency |
|||
{ |
|||
protected IDistributedCache<MenuWithDetailsDto> DistributedCache { get; } |
|||
|
|||
public MenuChangedHandler(IDistributedCache<MenuWithDetailsDto> distributedCache) |
|||
{ |
|||
DistributedCache = distributedCache; |
|||
} |
|||
|
|||
public Task HandleEventAsync(EntityUpdatedEventData<Menu> eventData) |
|||
{ |
|||
return DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); |
|||
} |
|||
|
|||
public Task HandleEventAsync(EntityDeletedEventData<Menu> eventData) |
|||
{ |
|||
return DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); |
|||
} |
|||
} |
|||
} |
|||
@ -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<EntityUpdatedEventData<Menu>>, ITransientDependency |
|||
{ |
|||
protected IDistributedCache<MenuWithDetailsDto> DistributedCache { get; } |
|||
|
|||
public MenuUpdatedHandler(IDistributedCache<MenuWithDetailsDto> distributedCache) |
|||
{ |
|||
DistributedCache = distributedCache; |
|||
} |
|||
|
|||
public async Task HandleEventAsync(EntityUpdatedEventData<Menu> eventData) |
|||
{ |
|||
await DistributedCache.RemoveAsync(MenuApplicationConsts.MainMenuCacheKey); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue