Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saves image to cache without downloading it. #714

Merged
merged 1 commit into from
Jun 13, 2014
Merged

Saves image to cache without downloading it. #714

merged 1 commit into from
Jun 13, 2014

Conversation

derpoliuk
Copy link
Contributor

No description provided.

@DimaVartanian
Copy link

+1, nice shortcut

@bpoplauschi
Copy link
Member

I would rather expose the cacheKeyForURL method from SDWebImageManager, it should give developers more flexibility.
Then, you could do:

SDWebImageManager *imageManager = [SDWebImageManager sharedManager];
SDImageCache *imageCache = imageManager.imageCache;
NSString *key = [imageManager cacheKeyForURL:url];
[imageManager.imageCache storeImage:image forKey:key toDisk:YES];

What do you think?

@DimaVartanian
Copy link

When you put [self cacheKeyForURL:url] did you mean [imageManager cacheKeyForURL:url]? That certainly works too but requires extra code for what I think is a pretty common use case (pre-caching resources). It would honestly be nice if both were surfaced so you could easily check the cache for members and such.

@bpoplauschi
Copy link
Member

Good catch, thanks for that. Yeap, we might do both.

bpoplauschi added a commit that referenced this pull request Jun 13, 2014
Saves image to cache without downloading it.
@bpoplauschi bpoplauschi merged commit b29850b into SDWebImage:master Jun 13, 2014
@derpoliuk
Copy link
Contributor Author

@bpoplauschi I was thinking to expose cacheKeyForURL: but didn't want to move imageCache to SDWebImageManager.h. It would be good functionality though.

Thanx for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants