CachedAsyncImage

fun CachedAsyncImage(data: Any?, contentDescription: String?, modifier: Modifier = Modifier, memoryCachePolicy: ImageCachePolicy = ImageCachePolicy.ENABLED, diskCachePolicy: ImageCachePolicy = ImageCachePolicy.ENABLED, networkCachePolicy: ImageCachePolicy = ImageCachePolicy.ENABLED, memoryCacheKey: String? = null, diskCacheKey: String? = memoryCacheKey, crossfade: Boolean = true, placeholder: Painter? = null, error: Painter? = null, fallback: Painter? = error, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, clipToBounds: Boolean = true)

Loads an image from a URL, file, or bytes (data) with explicit memory, disk, and network cache policies. Use it instead of depending on an image library from feature code; the loader (Coil) is an implementation detail.

placeholder shows while loading, error when loading fails, and fallback when data is null. Pass null contentDescription only for decorative images.

Network policies with reads disabled (DISABLED or WRITE_ONLY) never contact the server. Memory and disk cache hits remain available according to their own policies; a cache miss shows error.

On the web (Wasm) there is no disk cache, so diskCachePolicy has no effect; the browser's HTTP cache governs repeated network loads.

Parameters

memoryCacheKey

a stable key for content whose URL changes (for example signed URLs); diskCacheKey defaults to it.