Skip to content

Commit

Permalink
Merge pull request #349 from jp7677/cache-invalidation
Browse files Browse the repository at this point in the history
Create a new cache for each site generation
  • Loading branch information
jp7677 authored Oct 26, 2023
2 parents 8c74654 + 1d5a7cf commit 2aa3ec0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ fun generateDiagrams(workspace: Workspace, exportDir: File) {
}
}

private val diagramCache = ConcurrentHashMap<String, String>()

fun generateDiagramWithElementLinks(workspace: Workspace, view: View, url: String): String {
fun generateDiagramWithElementLinks(
workspace: Workspace,
view: View,
url: String,
diagramCache: ConcurrentHashMap<String, String>
): String {
val diagram = generatePlantUMLDiagramWithElementLinks(workspace, view, url)

val name = "${diagram.key}-${view.key}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import java.io.File
import java.math.BigInteger
import java.nio.file.Path
import java.security.MessageDigest
import java.util.concurrent.ConcurrentHashMap

fun copySiteWideAssets(exportDir: File) {
copySiteWideAsset(exportDir, "/css/style.css")
Expand Down Expand Up @@ -62,8 +63,9 @@ fun generateSite(
serving: Boolean = false
) {
val generatorContext = GeneratorContext(version, workspace, branches, currentBranch, serving) { key, url ->
val diagramCache = ConcurrentHashMap<String, String>()
workspace.views.views.singleOrNull { view -> view.key == key }
?.let { generateDiagramWithElementLinks(workspace, it, url) }
?.let { generateDiagramWithElementLinks(workspace, it, url, diagramCache) }
}

val branchDir = File(exportDir, currentBranch)
Expand Down

0 comments on commit 2aa3ec0

Please sign in to comment.