Trying async cache for DelegatedExpressionHandler
This commit is contained in:
@@ -12,7 +12,8 @@ class DelegatedExpressionHandler(
|
|||||||
) : ExpressionHandler {
|
) : ExpressionHandler {
|
||||||
private val evaluationCache: Cache<Int, Double?> = Caffeine.newBuilder()
|
private val evaluationCache: Cache<Int, Double?> = Caffeine.newBuilder()
|
||||||
.expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS)
|
.expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS)
|
||||||
.build()
|
.buildAsync<Int, Double?>()
|
||||||
|
.synchronous()
|
||||||
|
|
||||||
override fun evaluate(expression: String, context: PlaceholderContext): Double? {
|
override fun evaluate(expression: String, context: PlaceholderContext): Double? {
|
||||||
expression.fastToDoubleOrNull()?.let { return it }
|
expression.fastToDoubleOrNull()?.let { return it }
|
||||||
|
|||||||
Reference in New Issue
Block a user