Posted on

SharedFlow vs StateFlow

https://kt.academy/article/sharedflow_vs_stateflow

StateFlow and SharedFlow seem similar, but they are designed for different use cases, and they should not be confused. Let’s discuss the key differences and usages.

Let’s start with how they work. SharedFlow resembles a broadcast channel—emitted values are delivered to all observers. It allows setting a replay parameter specifying how many past values should be emitted to new observers.

Posted on

Kotlin 2.4.20-RC is out

https://twitter.com/kotlin/status/2087482878875533325

📢 Kotlin 2.4.20-RC is out! Here are some of the highlights:

✅ Standard library: Support for coroutine stack trace recovery and new functions for checking equality and uniqueness of collection elements

✅ Kotlin/Native: New Swift export features, and the first Kotlin compiler native image

✅ Kotlin/Wasm: Changes to top-level require() calls in @JsFun declarations, improved companion object initialization order, and support for Wasmtime in the Kotlin Gradle plugin

✅ Kotlin/JS: New DSL for browser-testing and support for exporting suspend lambdas as async functions

✅ Build tools API: Support for new targets: Kotlin/JS, Kotlin/Wasm, and Kotlin metadata

Try it out: kotl.in/2-4-20-rc

Posted on

KoCache: A Coroutine-Native Loading Cache

https://codeberg.org/aasplund/KoCache

KoCache is a thread-safe, coroutine-based caching library for Kotlin. It provides a loading cache implementation designed for high-concurrency environments, featuring request coalescing (thundering herd protection), active TTL eviction, and LRU capacity enforcement.

The library utilizes Kotlin’s Deferred and Mutex primitives to synchronize access, ensuring that concurrent requests for the same missing key result in a single execution of the loader function.

https://twitter.com/marcinmoskala/status/2085713023025463330