public async Task Handle(RemoveSuperpowerCommand notification, CancellationToken cancellationToken) { if (!notification.IsValid()) { NotifyValidationErrors(notification); return; } _superpowerRepository.Remove(notification.Id); if (await CommitAsync()) { var superpowerEvent = new SuperpowerRemovedEvent(notification.Id); await _bus.RaiseEvent(superpowerEvent); } }
public async Task Handle(SuperpowerRemovedEvent notification, CancellationToken cancellationToken) { await _cacheManager.RemoveAsync($"superpowerGetAsync_{notification.Id}"); }