I see that both the iOS and Android native clients have a SQL backed normalized cache. I have a React Native project and need the same thing. The app needs to work offline, so it builds an enormous cache (pre-fetching). I am trying to reduce the memory footprint – I think this is a common use-case in mobile, which is probably why the mobile clients have it.
I didn’t see one for React Native and I am thinking about approaches to making one. I read the JS InMemoryCache to get an idea of what would need to be done.
I should also say that I am aware of apollo-cache-persist, which I understand to be something different. I want the cache to never be in memory (live in the DB) – not just a way to persist and restore.
My questions:
-
Has anyone else tried this or seen anything like it? I couldn’t find anything
-
It feels like I would need to reproduce a lot of the work in InMemoryCache to get all of the features. There doesn’t seem to be any hook to just replace the backing store.
-
Is there any plan to make it easier to make alternative caches (or just replace storage) but still get the configuration options like
typePolicies
. -
Any general advice for proceeding in a way that is future proof and possibly able to be adopted in a future version?