【问题标题】:How to disable InMemoryCache for Apollo GraphQL client?如何为 Apollo GraphQL 客户端禁用 InMemoryCache?
【发布时间】:2019-09-27 08:10:15
【问题描述】:

我正在尝试完全禁用 apollo 客户端上的缓存,但它不起作用。

我尝试将 fetchPolicy 设置为“仅限网络”或“无缓存”。有什么我遗漏的吗?

【问题讨论】:

    标签: apollo-client apollo-cache-inmemory


    【解决方案1】:

    您可以在需要清理缓存时删除持久化器。

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

    【讨论】:

      猜你喜欢
      • 2019-06-22
      • 2019-07-26
      • 2022-12-12
      • 1970-01-01
      • 2021-05-30
      • 2019-11-19
      • 2020-09-19
      • 2019-06-30
      • 2019-06-10
      相关资源
      最近更新 更多