How to disable cache in apollo-link or apollo-client?

前端 未结 3 1301
粉色の甜心
粉色の甜心 2021-02-01 00:21

I\'m using apollo-client, apollo-link and react-apollo, I want to fully disable cache, but don\'t know how to do it.

I read the source of

3条回答
  •  故里飘歌
    2021-02-01 01:14

    Actually, setting fetchPolicy to network-only still saves the response to the cache for later use, bypassing the reading and forcing a network request.

    If you really want to disable the cache, read and write, use no-cache. Which is "similar to network-only, except the query's result is not stored in the cache."

    Take a look at the official docs: https://www.apollographql.com/docs/react/data/queries/#configuring-fetch-logic

提交回复
热议问题