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

老子叫甜甜 提交于 2020-01-04 14:15:24

问题


I've got a simple question about datastore keys. If I delete an entity, is there any possibility that the key will be created again? or each key is unique and can be generated only one-time?

Thanks.


回答1:


It is definitely possible to re-use keys.

Easy to test, for example using the datastore admin page:

  • create an entity for one of your entity models using a custom/specified key name and some property values
  • delete the entity
  • create another one using the same key name and different property values...

As for the keys with auto-generated IDs it is theoretically possible, but I guess rather unlikely due to the high number of possibilities. From 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.


来源:https://stackoverflow.com/questions/42093436/google-app-engine-datastore-will-a-deleted-key-regenerate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!