You can watch this episode by subscribing to Cocoacasts Plus.

Image Caching in Swift

Limiting the Cache on Disk

Image Caching in Swift
1 Cancelling Image Requests 10:19
2 Caching Images in Memory Plus 09:44
3 Caching Images on Disk Plus 09:27
4 Asynchronously Reading Data from Disk Plus 10:41
5 Limiting the Cache on Disk Plus 12:41
6 Image Caching with Kingfisher 10:48
Download Your Free Copy of
The Missing Manual
for Swift Development

The Guide I Wish I Had When I Started Out

Join 20,000+ Developers Learning About Swift Development

Download Your Free Copy

Earlier in this series, you learned that a cache on disk has a number of benefits. It persists the cache across launches and it can be used to seed a cache in memory. Even though modern devices have plenty of disk space, we need to be mindful of the space the cache on disk takes up on the user's device. Applications like Twitter and Instagram fetch hundreds if not thousands of images. Even if those images are optimized and small in size, the cache on disk can grow quickly, taking up a non-trivial amount of space on the user's device. In this episode, we add the ability to limit the size of the cache on disk, similar to how the image service limits the size of the cache in memory.

Instant and Unlimited Access
to 400+ Cocoacasts Tutorials


$19 / month

Pay Once a Month
30 Day Money Back Guarantee


$8.25 / month (billed annually)

Pay Once a Year and Save $129
30 Day Money Back Guarantee
Access to All Books

Next Episode "Image Caching with Kingfisher"