Apollo Client cache duration

Hello, I’ve tried to find any information regarding expiration of Apollo Client cache when using it like this:

fetchPolicy: 'cache-first',

but never found any.

Is cache cannot be expired unless we call resetStore() ? If we open a new tab in browser, a new Apollo client will be created during component rendering and new cache for that specific client is used, right?

Thanks for any replies.

1 Like

Correct, the cache does not expire until you close the tab/browser or manually reset the cache.
If you want the existing cache to persist when opening a new tab, you can use something like apollo-cache-persist (keep in mind that this will NOT keep multiple cache instances synchronized during runtime, it only restores the cache from localStorage once at app initialization)