Popularity
0.4
Stable
Activity
6.9
Declining
2
1
0

Programming language: Kotlin
License: MIT License
Tags: Misc    
Latest version: v0.5.0

kache alternatives and similar libraries

Based on the "Misc" category.
Alternatively, view kache alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of kache or a related project?

Add another 'Misc' Library

README

Kotlin Cache Abstraction

This library applies caching to Kotlin functions, thus reducing the count of function executions.

Documentation

You can read more about Kache on our Documentation.

Setup

Gradle / Groovy

repositories {
  maven { url 'https://jitpack.io' }
}

dependencies {
  implementation 'com.themichailov:kache:0.5.0'
}

Gradle / Kotlin

repositories {
  maven("https://jitpack.io")
}

dependencies {
  implementation("com.themichailov:kache:0.5.0")
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.themichailov</groupId>
    <artifactId>kache</artifactId>
    <version>0.5.0</version>
</dependency>

Supported cache engines

  • Caffeine
  • Hazelcast
  • Ehcache

Usage

import com.themichailov.kache.KacheConfig
import com.themichailov.kache.cacheable
import com.themichailov.kache.updateCache
import com.themichailov.kache.evictCache

data class User(val email: String, var age: Int)
private val users = mapOf<String, User>()

KacheConfig.config("User", CaffeineKache(Caffeine.newBuilder().build()))

fun fetchUser(email: String): User = cacheable(name = "User", key = email) {
    users[email] ?: error("User not found!")
}

fun updateUser(email: String, age: Int) = updateCache(name = "User", key = email) {
    val user = users[email] ?: error("User not found!")
    user.age = age
}

fun importUsers(source: Path) = evictCache(name = "User", all = true) {

}

Contributing

Thank you for considering contributing to Kache! You can read the contribution guide [here](CONTRIBUTING.md).

Code of Conduct

In order to ensure that the Kache is welcoming to all, please review and abide by the [Code of Conduct](CODE_OF_CONDUCT.md).

License

Kache is open-sourced software licensed under the [MIT licensed](LICENSE).


*Note that all licence references and agreements mentioned in the kache README section above are relevant to that project's source code only.