Skip to content

Commit

Permalink
Trying async cache for DelegatedExpressionHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Dec 5, 2024
1 parent 2158be4 commit d87fcc9
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class DelegatedExpressionHandler(
) : ExpressionHandler {
private val evaluationCache: Cache<Int, Double?> = Caffeine.newBuilder()
.expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS)
.build()
.buildAsync<Int, Double?>()
.synchronous()

override fun evaluate(expression: String, context: PlaceholderContext): Double? {
expression.fastToDoubleOrNull()?.let { return it }
Expand Down

0 comments on commit d87fcc9

Please sign in to comment.