缓存时,是否有一种方法可以尊重AppSync中的现场选择?
我有一个启用了lambda数据源的缓存的Appsync。 当我发送以下查询时:
{
todoItems {
field1
}
}
然后,我会收到请求字段的响应,并且此响应也会由Appsync立即缓存
{
"todoItems":
[
{
"field1": "some data"
}
]
}
(而Cached项目仍然存在),我正在发送相同的查询,但具有额外的字段:
{
todoItems {
field1
field2
}
}
并获得响应此额外场所带有零值:
{
"todoItems":
[
{
"field1": "some data"
"field2": null
}
]
}
然后我在等待缓存会再次到期并再次发送查询的
{
"todoItems":
[
{
"field1": "some data"
"field2": "other data"
}
]
}
情况不同的子场。
I have an AppSync with caching enabled for a lambda data source.
When I'm sending following query:
{
todoItems {
field1
}
}
Then I'm getting response for requested field, and this response is also gets cached by AppSync
{
"todoItems":
[
{
"field1": "some data"
}
]
}
Then immediately (while cached item is still there) I'm sending same query but with extra field:
{
todoItems {
field1
field2
}
}
And getting response where this extraField comes with null value:
{
"todoItems":
[
{
"field1": "some data"
"field2": null
}
]
}
Then I'm waiting while the cache will expire and sending query once again, and only then getting correct result:
{
"todoItems":
[
{
"field1": "some data"
"field2": "other data"
}
]
}
So it looks like AppSync cached first response and responding with cached data, even for requests with different selection of subfields.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论