Reputation: 9273
i'm using the amazing SDWebImage
project, to refresh the download of an image i use this:
[[SDImageCache sharedImageCache] removeImageForKey:img_key fromDisk:YES];
and works, but i want to know if it's possible to give a tag for some images, so i can clear the cache for a set of images and not for only one, it's that possible?
Upvotes: 4
Views: 2995
Reputation: 4089
SDImageCache
has a init method named - (id)initWithNamespace:(NSString *)ns;
you can use it to init a new instance instead of sharedImageCache
, thus you can clearDisk
, clearMemory
without affecting others.
Upvotes: 3
Reputation: 179
as you can see SDImageCache
is using memCache
( NSCache
). You cannot remove defined set of images by tags for removing. You can clean memory/clear disk using this methods from.
- (void)clearMemory;
- (void)clearDisk;
I suggest you to create own nscache to define keys for images that you would like to remove. Then you can easily change it, or extend SDImageCache
.
Cheers
Upvotes: 0