From d87fcc96bb6d4fde30a4cfd2d71df287d78d479c Mon Sep 17 00:00:00 2001 From: Will FP Date: Thu, 5 Dec 2024 16:31:30 +0000 Subject: [PATCH] Trying async cache for DelegatedExpressionHandler --- .../eco/internal/spigot/math/DelegatedExpressionHandler.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/math/DelegatedExpressionHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/math/DelegatedExpressionHandler.kt index 4470625bd..da3eacdb8 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/math/DelegatedExpressionHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/math/DelegatedExpressionHandler.kt @@ -12,7 +12,8 @@ class DelegatedExpressionHandler( ) : ExpressionHandler { private val evaluationCache: Cache = Caffeine.newBuilder() .expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS) - .build() + .buildAsync() + .synchronous() override fun evaluate(expression: String, context: PlaceholderContext): Double? { expression.fastToDoubleOrNull()?.let { return it }