graphql - 中继现代缓存与存储
问题描述
通读中继文档,我对网络层(https://facebook.github.io/relay/docs/en/network-layer.html)与中继存储(https:// facebook.github.io/relay/docs/en/relay-store.html)。
这是两个不同的缓存吗?哪一个会自动获得 Relay 收集的垃圾?
解决方案
@anon 网络层是您将客户端连接到 GraphQL 服务器、在应用程序上创建存储以缓存数据的方式。第二个链接更多地是关于如何在运行突变后更新store
使用函数。updater
正如您在第一个链接中看到的:
// Create a network layer from the fetch function
const network = Network.create(fetchQuery);
const store = new Store(new RecordSource())
您正在使用relay-runtime
包创建网络层/存储。
希望能帮助到你 :)
推荐阅读
- python - python problem regarding of creation of objects using loop
- qt - 如何允许浮动 Qt5 停靠小部件的交互式调整大小
- forth - GForth:将浮点数转换为字符串
- java - 如何在不丢失元数据的情况下从 InputStream 保存视频文件?
- javascript - 根据 innerWidth 属性更改元素宽度
- android - RxJava 计算线程 + Android Keystore 阻塞 UI?
- pyspark - pyspark.sql.functions abs() 因 PySpark 列输入而失败
- python - 重构python代码:列表的动态解包
- regex - 批处理:FINDSTR 正则表达式不起作用
- eclipse - 如何让水平两指触摸板滚动在 Eclipse 中工作?