apollo-boost如何进行查询的选择性缓存

我想在阿波罗缓存中仅缓存少量查询。下面是我的代码,它将缓存所有查询。但是我只想缓存一些查询,其他查询不应该缓存。我该怎么办?

const client = new ApolloClient({
  link: authLink.concat(httpLink),// Chain it with the HttpLink
  cache
});

const data = await this.composeQuery(query,params);
async composeQuery(query: any,params: any) {
    const { data,errors } = await client.query({
      query,variables: params
    })
    if (errors) return this.notifyError();

    if (data) return data;
  }

如果我调用下面的方法,我会将不同的查询传递给composeQuery方法。仅某些查询必须被缓存。 const data = await this.composeQuery(query,params);

iCMS 回答:apollo-boost如何进行查询的选择性缓存

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1520216.html

大家都在问