I'll just leave this as a note here - I was running into issue where Apollo Cache was being deleted, and I couldn't figure out what's causing this.
Looks like root cause for this issue was that when you call a persistCache() method, initial cache size is set to 1MB, and if your cache exceeds this amount, cache will be overridden / purged.
Solution is to set persistCache()maxSize arg to a large number (or ideally to false), so there won't be any limit on the cache size, and therefore it won't get purged when it gets full.
Hey folks
I'll just leave this as a note here - I was running into issue where Apollo Cache was being deleted, and I couldn't figure out what's causing this.
Looks like root cause for this issue was that when you call a
persistCache()
method, initial cache size is set to 1MB, and if your cache exceeds this amount, cache will be overridden / purged.Solution is to set
persistCache()
maxSize
arg to a large number (or ideally tofalse
), so there won't be any limit on the cache size, and therefore it won't get purged when it gets full.https://github.com/apollographql/apollo-cache-persist/blob/master/docs/advanced-usage.md