Browse Source

Only the latest version (dev) of the document needs to update the cache.

pull/2826/head
maliming 7 years ago
parent
commit
0325126eb3
  1. 11
      modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs

11
modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs

@ -178,9 +178,16 @@ namespace Volo.Docs.Documents
}
var document = await _documentRepository.FindAsync(project.Id, documentName, languageCode, version);
if (document == null)
{
return await GetDocumentAsync();
}
//TODO: Configurable cache time?
if (document == null || document.LastCachedTime + TimeSpan.FromDays(30) < DateTime.Now)
//Only the latest version (dev) of the document needs to update the cache.
if (!project.LatestVersionBranchName.IsNullOrWhiteSpace() &&
document.Version == project.LatestVersionBranchName &&
//TODO: Configurable cache time?
document.LastCachedTime + TimeSpan.FromHours(2) < DateTime.Now)
{
return await GetDocumentAsync();
}

Loading…
Cancel
Save