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

checking if image is cached #79

Closed
DanielRanLehmann opened this issue Apr 9, 2016 · 4 comments
Closed

checking if image is cached #79

DanielRanLehmann opened this issue Apr 9, 2016 · 4 comments

Comments

@DanielRanLehmann
Copy link

I might be missing something obvious. I'm using PINcache to store my images that is async plugged into a custom cell in a collectionView.

How can I check if an image is cached?

Is there any similar method to SDWebImage where you can check if an image is cached on disk like this:

  • (BOOL)diskImageExistsForURL:(NSURL *)url;
  • Daniel Lehmann
@garrettmoon
Copy link
Collaborator

@DanielRanLehmann You can obviously just call objectForKey, but that will instantiate the object off disk which if you just want to check if it's available is expensive. Instead, you can access the memoryCache and diskCache directly. objectForKey on the memory cache will determine existence (and isn't expensive). fileURLForKey is the cheapest way to check existence on the disk cache.

I'd be happy to accept a pull request which exposes methods on the memoryCache, diskCache and PINCache to essentially do this all.

@DanielRanLehmann
Copy link
Author

Thanks for the quick response 👍 I will look into it right away and make a pull request if it works out..

@danielgalasko
Copy link
Contributor

@garrettmoon I think this can be closed:)

@garrettmoon
Copy link
Collaborator

Thanks!

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

No branches or pull requests

3 participants