apollo-clientapollo-cache-inmemory

How to disable InMemoryCache for Apollo GraphQL client?


I am trying to completely disable caching on the apollo-client but its not working.

I have tried to set the fetchPolicy to 'network-only' or 'no-cache'. Is there something that I am missing?


Solution

  • You can just remove the persistor whenever you need to clean the cache.

      const persistor = new CachePersistor({ cache: this.cache, storage: window.sessionStorage as any });
      await persistor.remove();