Hello I am using the SDWebImage framework in a project and I was wanting to download and cache some images, but I think my code is storing the image in the cache twice? Is there a way to store a UIImage in the cache by a key one time? Here is my code. Possibly there is just something I missed? Looks like doing this in my allocations instrument is pilling up a lot of memory. | ||
add comment |
3 | I'm surprised nobody answered this question, but I've had a similar question and came across this, so I'll answer it for people viewing this going forward (assuming you've sorted this out yourself by now). To directly answer your question, yes, you are caching the image twice. Download calls to SDWebImageManager automatically cache images with keys based on the absoluteString of the image's url. If you want your own key, you can use the download call on SDWebImageDownloader which as far as I can tell does NOT cache by default. From there you can call the sharedImageCache as you're already doing and cache with whatever key you want. That aside, it is strange you're seeing allocations piling up in any case as SDWebImage likes to cache to disk and not memory generally. Maybe something else is going on at the same time? Hope this helps, -Brandon | ||
No comments:
Post a Comment