Pra Do
Pra Do

Reputation: 293

How to get the image from in memory cache using SDWebImage?

I have implemented SDWebImage in cellforrowatindexpath method. The problem here is when i scroll down the tableview the images are loading from web which is expected but when i scroll up the tableview the images are again downloading. What is the way to get rid of this problem. I don't want to load images from url overtime (since there is a usage limit with the web service call). I chose to use SDWebImage API for in memory cache so that once the images are loaded they are taken from cache to show it on the UI instead of making the web service call everytime. Here is my code:

[cell.placeImage sd_setImageWithURL:url placeholderImage:nil options:SDWebImageCacheMemoryOnly];

The above line is the only code in that method. Please help me. Any kind of help is appreciated. I have seen other questions in this community but nobody said how to get an image from the cache memory.

Upvotes: 1

Views: 956

Answers (1)

Oleg Gordiichuk
Oleg Gordiichuk

Reputation: 15512

For refreshing of the images you should use option : SDWebImageRefreshCached

[imageView sd_setImageWithURL:url placeholderImage:nil options:SDWebImageRefreshCached];

Upvotes: 1

Related Questions