nestegg
Very simple Kotlin caching library
Download
implementation("xyz.runnerbe:nestegg:${version}")
Usage
fun <T> T.egg(vararg key: String): T // caching data
fun <T> pick(vararg key: String): T? // get cached data or null if no cached
fun <T> pickOrElse(vararg key: String, or: () -> T): T // get cached data or execute `or` block
fun <T> pickOrEgg(vararg key: String, or: () -> T): T // get cached data or execute `or` block and caching it
suspend fun <T> pickOrSuspendElse(vararg key: String, or: suspend () -> T): T
suspend fun <T> pickOrSuspendEgg(vararg key: String, or: suspend () -> T): T
Example
Want example usage? Please see test code.
Caution
This library is designed for RunnerBe-Android development.