Skip to content

Commit

Permalink
Improve the docs to preload only into the disk cache. (#1760)
Browse files Browse the repository at this point in the history
* Improve the docs to preload only into the disk cache.

* Tweak.

* Tweak.
  • Loading branch information
colinrtwhite committed May 14, 2023
1 parent 8fe5219 commit 65ff90e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,17 @@ val request = ImageRequest.Builder(context)
imageLoader.enqueue(request)
```

To preload a network image only into the disk cache, disable the memory cache for the request:
To preload a network image only into the disk cache:

```kotlin
val request = ImageRequest.Builder(context)
.data("https://example.com/image.jpg")
// Disable reading from/writing to the memory cache.
.memoryCachePolicy(CachePolicy.DISABLED)
// Set a custom `Decoder.Factory` that skips the decoding step.
.decoderFactory { _, _, _ ->
Decoder { DecodeResult(ColorDrawable(Color.BLACK), false) }
}
.build()
imageLoader.enqueue(request)
```
Expand Down

0 comments on commit 65ff90e

Please sign in to comment.