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

Don't use url for cache key #5

Closed
kevinrenskers opened this issue Nov 11, 2010 · 3 comments
Closed

Don't use url for cache key #5

kevinrenskers opened this issue Nov 11, 2010 · 3 comments

Comments

@kevinrenskers
Copy link

Hi,

Great library, I use it often. I have discovered a problem in one of my apps: some images changed on the website, but still use the same URL. Because the image cache uses that url (which didn't change), the user always sees the same old image.

Would it be possible to either use some sort of md5 hash for the cache key? Or something like this, where I can set a different cache key?

[[SDWebImageManager sharedManager] 
    downloadWithURL:image_url 
    useCacheKey:news_title 
    delegate:self
];

With something like this, it would download the new image for a new news item, even if the image url would've been "re-used" on the site.

@kevinrenskers
Copy link
Author

Or alternatively, could the cache get some sort of time-out? After a day in the cache, always get the latest version of the image.

@kevinrenskers
Copy link
Author

For now I've solved my problem by putting ?uid={news_id} after the image url.

@rs
Copy link
Member

rs commented Nov 11, 2010

You should use common HTTP cache busting technique where the image URL change whenever then image's content change. For instance you can put the image timestamp in the query-string of the image URL. This way you will invalidate the cache of SDWebImage as well as all intermediate caches. You would also be able to set long living HTTP cacheability to you image in order to benefit from intermediate proxy caches.

lucolivier-dumaisblais pushed a commit to lightspeedretail/SDWebImage that referenced this issue Oct 6, 2021
…ImageCache-for-TLS-HOS-16381 to lightspeed-fixes

* commit '2377014b08e8afe55528c2225084cb55a93b2633':
  HOS-16381 Update SDWebImage to support custom certificates
This issue was closed.
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

No branches or pull requests

2 participants