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.
Subscribe to Cocoacasts Plus to watch this episode.
Image Caching in Swift
Limiting the Cache on Disk
by Bart Jacobs in Networking
Swift 5
Xcode 12
iOS 14
Image Caching in Swift
-
10:19
-
09:44
-
09:27
-
5 Limiting the Cache on Disk
12:41
-
6 Image Caching with Kingfisher
10:48