缓存时,是否有一种方法可以尊重AppSync中的现场选择?

发布于 2025-02-05 20:54:31 字数 658 浏览 2 评论 0原文

我有一个启用了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文