// -------------------------------------------------------------------- event handlers /// <summary> /// Handles <see cref="NavUpdated"/> event raised by an <see cref="INavProvider"/>, it /// invalidates caches for all menus. /// </summary> /// <param name="notification"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task Handle(NavUpdated notification, CancellationToken cancellationToken) { // if nav updated was a page and it is now a draft if (notification.Type == ENavType.Page && notification.IsDraft) { // 1. update home await HandleHomeAsync(notification.Id, notification.Type); // 2. remove it from any menus that contain it await HandleMenusAsync(notification.Id, notification.Type); } // invalidate all menus cache var menuMetas = await metaRepository.GetListAsync(EMetaType.Menu); foreach (var meta in menuMetas) { await InvalidateMenuCacheAsync(meta.Key); } }