Merge pull request #714 from derpoliuk/master

Saves image to cache without downloading it.
This commit is contained in:
Bogdan Poplauschi 2014-06-13 10:11:28 +03:00
commit b29850b61b
2 changed files with 17 additions and 0 deletions

View File

@ -193,6 +193,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)];