Adds -[SDWebImageManager saveImageToCache:forURL:] method

This commit is contained in:
derpoliuk 2014-05-13 11:11:36 +03:00
parent 8fe72023dc
commit 78a50d3929
2 changed files with 17 additions and 0 deletions

View File

@ -187,6 +187,16 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
progress:(SDWebImageDownloaderProgressBlock)progressBlock
completed:(SDWebImageCompletedWithFinishedBlock)completedBlock;
/**
* Saves image to cache for given URL
*
* @param image The image to cache
* @param url The URL to the image
*
*/
- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url;
/**
* Cancel all current opreations
*/

View File

@ -215,6 +215,13 @@
return operation;
}
- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url {
if (image && url) {
NSString *key = [self cacheKeyForURL:url];
[self.imageCache storeImage:image forKey:key toDisk:YES];
}
}
- (void)cancelAll {
@synchronized (self.runningOperations) {
[self.runningOperations makeObjectsPerformSelector:@selector(cancel)];