/// <summary> /// Get cached metadata (json serialization of gitlab project-endpoint) /// </summary> /// <param name="project">Database project object</param> /// <returns>JsonProject with all project metadata</returns> public async Task <JsonProject> GetCachedProjectMeta(DbProject project) { var globalProjectId = project.Id; // read from cache var cachedProjectMeta = _jsonCache.ReadProject(globalProjectId); // return if in cache if (cachedProjectMeta != null) { return(cachedProjectMeta); } // write into cache var account = project.Account; var gitlabClient = _gitlabService.GetGitlabClient(account.HostUrl, account.AuthenticationToken); var gitlabProject = await gitlabClient.GetProjectById(project.GitlabProjectId); _jsonCache.WriteProject(globalProjectId, gitlabProject); return(gitlabProject); }