mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 11:27:21 +01:00
Makes a cache for Media Items
This commit is contained in:
@@ -35,6 +35,17 @@ fun <K, V> produceCachedState(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun <K, V> produceCachedState(
|
||||
cache: CachedState<K, V>,
|
||||
key: String,
|
||||
updateValue: K,
|
||||
): State<V?> {
|
||||
return produceState(initialValue = cache.cached(updateValue), key1 = key) {
|
||||
value = cache.update(updateValue)
|
||||
}
|
||||
}
|
||||
|
||||
interface CachedState<K, V> {
|
||||
fun cached(k: K): V?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user