Closed avielg closed 5 months ago
Hi @avielg - I suspect the file size behaviour is due to the internals of sqlite; have you tried setting the shouldVacuumOnClear
property in SQLiteNormalizedCache.init
to true
? By default it is false
and when configured with true
the vacuum
command will be run whenever the sqlite cache is cleared. It seems that without forcing that behaviour sqlite is left to decide when to recover disk space which may not be immediately after deleting the records.
As for the file not being removed; we never remove the db file. It's created at startup if it doesn't exist but we have no code to delete the file.
oh shouldVacuumOnClear
does it! Didn't know about this option, thank you!
This is good to close from my end :)
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.
Summary
We have a "clear cache" setting in our app, and when the user taps it we call
apollo.store.clearCache(..)
which succeeds, but the underlying sqlite file stays exactly the same size and is not removed. I tried to just delete the file after the success callback, but the store never re-creates it. Is this a bug with clearCache function or am I doing something wrong?Thank you!
Version
1.10.0
Steps to reproduce the behavior
Create a store like so:
Try to clear cache:
Logs
No response
Anything else?
No response