public async Task <UiLibraryPackage> FindPackageAsync(string packageId) { string key = $"{packageId}"; UiLibraryPackage item = _cacheManager.Get <UiLibraryPackage>(key); if (item != null) { return(item); } item = await _repository.FindPackageAsync(packageId); _cacheManager.Set(key, item, TimeSpan.FromDays(1)); return(item); }
private async Task <PackagesFileResult <IPackage> > ParseUiFrameworksAsync(DirectoryInfo dirInfo) { IEnumerable <PackageMetadata> packagesMetadata = FindUiPackages(dirInfo); List <Task <UiLibraryPackage> > tasks = new List <Task <UiLibraryPackage> >(); foreach (var item in packagesMetadata) { tasks.Add(_uiLibraryPackageRepository.FindPackageAsync(item.PackageId)); } await Task.WhenAll(tasks); List <UiLibraryPackage> packages = tasks.Select(p => p.Result).ToList(); return(new PackagesFileResult <IPackage> { PackageType = PackageType.UiLibrary, FileName = "Ui libraries", Packages = packages.OrderBy(p => p.PackageId).ToList() }); }