Skip to content

Commit

Permalink
Ensure URL caching is disabled in order to prevent from duplicate cac…
Browse files Browse the repository at this point in the history
…hing
  • Loading branch information
Olivier Poitrey committed Mar 17, 2010
1 parent a230f6a commit 439c015
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SDWebImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ + (void)setMaxConcurrentDownloads:(NSUInteger)max
downloadQueue.maxConcurrentOperationCount = max;
}

- (void)main
- (void)main
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
// In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
UIImage *image = [UIImage imageWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:NULL]];

if (!self.isCancelled && [delegate respondsToSelector:@selector(imageDownloader:didFinishWithImage:)])
{
Expand Down

0 comments on commit 439c015

Please sign in to comment.