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

using HTTP HEAD request to invalidate cache #302

Open
hixfield opened this issue Dec 30, 2017 · 3 comments
Open

using HTTP HEAD request to invalidate cache #302

hixfield opened this issue Dec 30, 2017 · 3 comments

Comments

@hixfield
Copy link

As far as I can see, the image caching does not check if the image stored in the local cache is still up to date with the image on the server (in case its a downloaded image of course). I think it would be a good addition to use the HTTP HEAD request (this sends you the headers => last motif timestamp back without the actually large image data itself) to verify if the image is outdated and in that case perform a new download from the server.

@jshier
Copy link
Contributor

jshier commented Apr 1, 2018

We likely don't want to do this manually but allow for some way to reissue the network request for a cached image so the server can tell us one way or another. One of the benefits of a non-persistent cache is that the app will redownload the images when it's relaunched anyway. We'll investigate this for the future.

@hixfield
Copy link
Author

Indeed needs investigation! It might be a good idea to not only support a HEAD request but also allow a custom closure to specify if the cache is still valid or if the image should be re-downloaded. I just had a project where the images ware downloaded via HTTPS (AlamofireImage) but the last modified timestamp of the image was checked via a Firebase API call...

@cnoon
Copy link
Member

cnoon commented Feb 22, 2020

It would be terribly inefficient to issue HEAD requests every time rather than load directly from the queue. Instead, we would want to expose the ability to ignore the cached image to force the image to re-download. As a non-convenient workaround, you could dig into the URLCache directly and remove the cached response before making the request if it's a blocker type issue.

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