Kingfisher

第六次读Kingfisher网络图片缓存库的思考与感受(稍微有点起色)

蹲街弑〆低调 提交于 2019-12-04 10:46:15
这节我们来优化一下之前的 硬盘存储,看看kingfiisher哪里做得好,我们稍微来学习一下。 从硬盘里检索图片模仿改进: open func retrieveImageInDiskCache(forKey key: String, options: KingfisherOptionsInfo? = nil) -> Image? { let options = options ?? KingfisherEmptyOptionsInfo let computedKey = key.computedKey(with: options.processor.identifier) return diskImage(forComputedKey: computedKey, serializer: options.cacheSerializer, options: options) } /* let options = options ?? KingfisherEmptyOptionsInfo let computedKey = key.computedKey(with: options.processor.identifier) 这两行不管是内存还是硬盘都要做一次,暂时不懂什么意思,先不管了。 */ 主要看: func diskImage(forComputedKey key: String