Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new cache for each site generation #349

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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