0

如果可能的话,我想为应用引擎实现已删除的密钥检测,而不会在删除时存储任何额外的实体/标记,因此我可以相应地显示 404 或 410 响应。

AFAIK 新实体键数字 ID 的分配没有特定顺序(至少是一个简单的顺序),但它们当然是保留/分配的,并且永远不会隐式地重用于新实体。

那么有没有办法检查以前是否分配了一个特定的键,但是存储在这个键下的实体后来被删除了?

我不在乎密钥是否是手动分配的并且从未用于存储任何数据,我会将其视为已删除。

4

1 回答 1

0

No, there's no way to determine if a key has already been allocated.

You mention that you'll treat allocated but unused keys as deleted, but note that this will result in returning the wrong status code in these cases - including in the potential situation where a key is allocated and later used: you'll mistakenly report it as deleted until it's first used.

于 2012-11-04T19:17:06.173 回答