0Pricing
Android Academy · Lesson

Caching and Performance

Memory and disk caching basics.

Why Caching Matters

Downloading and decoding an image is expensive: it uses bandwidth, battery, and CPU. If you refetch the same image every time a list scrolls, your app feels slow and burns data.

Caching stores decoded images and downloaded bytes so the next request is nearly instant. Coil ships with two caches by default: an in-memory cache (fast, decoded bitmaps) and a disk cache (persistent, raw bytes).

This lesson explains how they work and how to tune them.

Two Layers: Memory and Disk

Coil checks caches in order:

  • Memory cache: holds recently used decoded bitmaps in RAM. A hit here is instant, no decoding needed.
  • Disk cache: stores the original downloaded bytes on the device. A hit here skips the network but still decodes.
  • Network: the slow path, only used when both caches miss.

Memory is fast but small and cleared when the app dies; disk is larger and survives restarts.

All lessons in this course

  1. Loading Images with Coil
  2. Placeholders and Error States
  3. Caching and Performance
  4. Playing Audio and Video
← Back to Android Academy