google-app-engine - 在应用引擎模块之间共享数据

标签 google-app-engine go module google-cloud-datastore google-cloud-platform

我正在尝试使用 appengine 数据存储在 appengine 模块之间共享 key 。 我在一个模块中编写 key ,我可以从该模块中读取它。

尝试从第二个模块读取它不起作用,我没有得到这样的实体响应。

在模块之间共享 key 的最佳方式是什么?我可以为此使用数据存储吗?根据我在文档数据存储中阅读的内容,服务之间共享。但它似乎对我不起作用。

最佳答案

您可能会遇到最终一致性问题。数据存储是分布式的,因此一个服务可能会命中数据的一致版本,而另一个服务(模块)会命中另一个过时的版本。数据存储绝对是一种在模块之间共享数据的方式,因此它可能是一个一致性问题,除非您重组数据或查询以保持高度一致,否则您不能保证能够立即读回数据,或者这可能是其他一些问题,比如您在另一个模块中使用了错误的 key ,或者以某种方式访问​​了不同的命名空间。

以下是有关数据存储一致性的一些资源: https://cloud.google.com/datastore/docs/concepts/structuring_for_strong_consistency https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/ https://cloud.google.com/datastore/docs/best-practices

来自最后一个链接:

If you need strong consistency for your queries, use an ancestor query. (To use ancestor queries, you first need to structure your data for strong consistency.) An ancestor query returns strongly consistent results. Note that a non-ancestor keys-only query followed by a lookup() does not return strong results, because the non-ancestor keys-only query could get results from an index that is not consistent at the time of the query.

关于google-app-engine - 在应用引擎模块之间共享数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43821899/

相关文章:

google-app-engine - 创建有限的数据存储索引

go - 从 Go 代码构建 Docker 镜像

javascript - 需要时 Node 模块未定义

java - Maven文件夹布局: Should I place tests in the EAR or its sub-modules?

google-app-engine - 在 Appengine 上将 Google Cloud Storage 与 Golang 结合使用

wordpress - 谷歌云和 wordpress

google-app-engine - 如何在新的 Cloud Storage Api (Python) 中设置 CacheControl?

go - 带有两个外键的中间模型 : file structure?

google-app-engine - 如何在不同的模块上执行 App Engine Go SDK 延迟包?

linux - 如何使用 spi-loopback-test linux 内核模块?