public async Task <TreeNode <NavigationNode> > GetTree() { var builder = GetRootTreeBuilder(); var cacheKey = await _cacheKeyResolver.GetCacheKey(builder); var tree = await _treeCache.GetTree(cacheKey).ConfigureAwait(false); if (tree != null) { return(tree); } tree = await builder.BuildTree(this).ConfigureAwait(false); if (_navOptions.RootTreeBuilderName != Constants.ReflectionNavigationTreeBuilderName && !string.IsNullOrEmpty(_navOptions.IncludeAssembliesForScan)) { var helper = new NavigationTreeReflectionConverter(); await helper.ScanAndMerge(this, _navOptions.IncludeAssembliesForScan, tree).ConfigureAwait(false); } if (_navOptions.EnableSorting) { SortTreeNode(tree); } await _treeCache.AddToCache(tree, cacheKey); return(tree); }
public async Task <TreeNode <NavigationNode> > GetTree() { var builder = GetRootTreeBuilder(); var cacheKey = await _cacheKeyResolver.GetCacheKey(builder); var tree = await _treeCache.GetTree(cacheKey).ConfigureAwait(false); if (tree != null) { return(tree); } tree = await builder.BuildTree(this).ConfigureAwait(false); await _treeCache.AddToCache(tree, cacheKey); return(tree); }
public async Task ClearTreeCache() { foreach (var builder in _treeBuilders) { var cacheKey = await _cacheKeyResolver.GetCacheKey(builder); await _cache.RemoveAsync(cacheKey); } }