
com.jetbrains.pluginverifier.repository.cache.Memoizer.kt Maven / Gradle / Ivy
package com.jetbrains.pluginverifier.repository.cache
import com.github.benmanes.caffeine.cache.Caffeine
import java.util.concurrent.TimeUnit
import java.util.function.Supplier
fun memoize(expirationInMinutes: Long = 5, delegateSupplier: () -> T): Supplier = Caffeine.newBuilder()
.expireAfterWrite(expirationInMinutes, TimeUnit.MINUTES)
.build {
delegateSupplier()
}
.let { cache ->
Supplier { cache.get(Unit) }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy