Google App Engine(数据存储)- 删除的密钥会重新生成吗?

Google App Engine (datastore) - will a deleted key regenerate?

我有一个关于 datastore keys 的简单问题。如果我删除一个实体,是否有可能再次创建密钥?或者每个密钥都是唯一的并且只能生成一次?

谢谢。

绝对可以re-use键。

易于测试,例如使用数据存储管理页面:

  • 使用 custom/specified 键名和一些 属性 值
  • 为您的实体模型之一创建一个实体
  • 删除实体
  • 使用 相同的 键名和不同的 属性 值创建另一个...

至于带有 auto-generated 个 ID 的密钥,理论上是可能的,但我认为可能性不大,因为可能性很大。来自 Assigning identifiers:

Cloud Datastore can be configured to generate auto IDs using two different auto id policies:

  • The default policy generates a random sequence of unused IDs that are approximately uniformly distributed. Each ID can be up to 16 decimal digits long.
  • The legacy policy creates a sequence of non-consecutive smaller integer IDs.