Swift - How to save memory using AlamofireImage/ImageShack?

人走茶凉 提交于 2019-11-29 17:31:32

You just have copy & pasted the code from AlamofireImage:

let photoCache = AutoPurgingImageCache(
    memoryCapacity: 100 * 1024 * 1024,
    preferredMemoryUsageAfterPurge: 60 * 1024 * 1024
)

1024 bytes x 1024 bytes x 100 will create a 100 MB in-memory cache. After that limit is reached the cache size will be reduced to 60 MB. If you do not wan't such a big cache then just reduce it. There is no "correct" number here, it depends solely on your use case. I, personally, use 20 MB in memory cache and 100 MB disk cache.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!