Skip to main content

Kotlin

added in: v0.1.0

The xanthic-kotlin module provides extension functions for the CreateCache / CacheApiSpec that allows for some cleaner syntax.

Installation

build.gradle
dependencies {
implementation 'io.github.xanthic.cache:cache-kotlin'
}

createCache

added in: v0.1.0

val cache = createCache<String, Int> {
maxSize = 128
expiryType = ExpiryType.POST_ACCESS
expiryTime = Duration.ofMillis(420)
removalListener { key, value, cause ->
if (cause.isEviction) {
println("evicted: $key:$value")
}
}
}