-
Notifications
You must be signed in to change notification settings - Fork 48
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
Question: How to force reload request and expire existing cache? #47
Comments
Hi, You have a lot of options here... If you want to clean up the cache and remove old items, then you can use the You could temporarily disable the cache by resetting it to the default. You could create a NSMutableURLRequest with the correct caching policy. You could disable the cache for a session using:
You could verride the willCacheResponse function for the NSURLConnectionDelegate and return nil. See: You could just remove the cached file by getting the path from EVURLCache and then removing that file. You could do that by using something like:
|
i ended up using with alamofire .reloadIgnoringCacheData. this would try to fetch a request by ignoring cache and if there is internet connection it would reload latest content and rewrite cache to the latest content, correct? |
Yes, that's correct. |
i am making the request ignoring cache but it still is showing my cached content. do i have to delete the cache as well? |
EVURLCache.swift(145) cachedResponse(for:): EVURLCache.swift(237) storeCachedResponse(_:for:): EVURLCache.swift(215) storeCachedResponse(_:for:): |
why cache is not rewriting stored file ? |
Thats strange. when returning data there is a clear check for but you are right that it's also checked the moment the data is returned and it is checked if it should be written. but it will still be written if the file already exists. If it does not exist, then it will also not be written. My guess is that the actual request does not have the correct cachePolicy |
@evermeer now i have one more question. the response expiration is set to 2 minutes. |
The request headers: Accept-Ranges:bytes |
Hi, i am using this in my app and i would like to know how can i force reload a request to skip any existing caches and update the content view with the latest content?
The text was updated successfully, but these errors were encountered: