public async Task <DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); var cacheKey = CacheKeyGenerator.GenerateDocumentResourceCacheKey(project, input.Name, input.LanguageCode, input.Version); input.Version = string.IsNullOrWhiteSpace(input.Version) ? project.LatestVersionBranchName : input.Version; async Task <DocumentResource> GetResourceAsync() { var source = _documentStoreFactory.Create(project.DocumentStoreType); return(await source.GetResource(project, input.Name, input.LanguageCode, input.Version)); } if (HostEnvironment.IsDevelopment()) { return(ObjectMapper.Map <DocumentResource, DocumentResourceDto>(await GetResourceAsync())); } return(ObjectMapper.Map <DocumentResource, DocumentResourceDto>( await ResourceCache.GetOrAddAsync( cacheKey, GetResourceAsync, () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = _documentResourceAbsoluteExpiration, SlidingExpiration = _documentResourceSlidingExpiration } ) )); }
public Task <DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input) { return(DocumentAppService.GetResourceAsync(input)); }