-
Notifications
You must be signed in to change notification settings - Fork 663
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
iOS cache not entirely cleared when calling clearAll() #6375
Comments
Hi! I could not reproduce on my end, but a couple of remarks:
You can check the contents of the db by opening it with the cache viewer of the Apollo IDE plugin, or with |
Hey @BoD 👋 I think this might be the NSURLCache. Wondering if it would be possible to prevent the NSURLRequest from caching data if we set |
You're right about not seeing "FooMutation", but I do see the operation name. I've edited above |
Oh I see - The HTTP responses should not be cached actually as we set a In general there's not really a reason to use both an HTTP cache and the normalized cache at the same time, the normalized cache being sufficient. I think passing |
Yes they are definitely cached. I think NSURLRequestReloadIgnoringCacheData means that data is not read from the cache, but data can still be cached - https://medium.com/swiftblade/urlrequest-can-be-cached-regardless-of-cachepolicy-f33b25d96c63 I wonder if nil could be passed to the willCacheResponse completion handler here? |
Thanks for checking! That makes sense. Can you try Something like val client = ApolloClient.Builder()
.httpEngine(
DefaultHttpEngine(nsUrlSessionConfiguration = NSURLSessionConfiguration.ephemeralSessionConfiguration())
)
(...)
.build() If it works we may want to use that by default, as there's no reason to write to a cache that is never read. |
no sign of the mutation in the cache after making that change 🙌 |
Thanks for checking! Do you want to open a PR to use that by default? |
Thanks for the PR, I just merged it! I'll close this issue then. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better. |
Version
4.1.1
Summary
Two possible issues:
.doNotStore(true)
apolloClient.apolloStore.clearAll()
Steps to reproduce the behavior
.doNotStore(true)
, e.g.~/Library/Developer/CoreSimulator/Devices/<id>/data/Containers/Data/Application/<id>/Library/Caches/<id>/Cache.db-wal
for "mutation"apolloClient.apolloStore.clearAll()
Logs
The text was updated successfully, but these errors were encountered: