Kotlin
added in: v0.1.0
The xanthic-kotlin
module provides extension functions for the CreateCache / CacheApiSpec that allows for some cleaner syntax.
Installation
- Gradle
- Gradle - Kotlin DSL
- Maven
build.gradle
dependencies {
implementation 'io.github.xanthic.cache:cache-kotlin'
}
build.gradle.kts
dependencies {
implementation("io.github.xanthic.cache:cache-kotlin")
}
pom.xml
<dependency>
<groupId>io.github.xanthic.cache</groupId>
<artifactId>cache-kotlin</artifactId>
</dependency>
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")
}
}
}