如何解决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);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。