gpt4 book ai didi

google-app-engine - Google 将什么归类为 Google App Engine 中的数据存储写入操作?

转载 作者:太空宇宙 更新时间:2023-11-03 15:19:29 24 4
gpt4 key购买 nike

自从上周初 GAE 进入定价模型以来,我一直在努力解决超出我的 Datastore 读写操作配额的问题。我不确定 Google 是将一位作者的所有更新计为一次写入,还是将每列更新计为一次单独的写入。

如果后者是真的,我可以通过一个更新函数来更新参数中的 6 列来解决这个问题,还是我也需要为 6 次更新付费?

这是我现有的代码,用于同时更新玩家的分数(评分)和其他详细信息。目前,我总是使用来自客户的值填充姓名、电子邮件、评级、获胜、游戏和成就。一种解决方案可能是仅在它们的值发生变化时才从客户端发送它们。

Long key = Long.valueOf(updateIdStr);
System.out.println("Key to update: " + key);
PlayerPersistentData ppd =null;
try {
ppd = pm.getObjectById(
PlayerPersistentData.class, key);
// for all of these, make sure we actually got a value via
// the query variables
if (name != null && name.length() > 0) {
ppd.setName(name);
}

if (ratingStr != null && ratingStr.length() > 0) {
ppd.setRating(rating);
}

if (playedStr != null && playedStr.length() > 0) {
ppd.setPlayed(played);
}

if (wonStr != null && wonStr.length() > 0) {
ppd.setWon(won);
}

if (encryptedAchievements != null
&& encryptedAchievements.length() > 0) {
ppd.setAchievements(achievements);
}

if (email != null & email.length() > 0) {
ppd.setEmail(email);
}

resp.getWriter().print(key);
} catch (JDOObjectNotFoundException e) {
resp.getWriter().print(-1);
}
}

最佳答案

您需要支付的写入次数取决于您的实体。通常,您需要为实体的 1 次写入和每个索引更新的 1 次写入付费。每个索引属性都包含在升序和降序单属性索引中,因此每个索引实体至少有 2 次写入,加上复合(用户定义)索引的任何写入。

更新现有实体时,您需要为旧索引和新索引的差异付费。因此,如果您修改一个属性,您需要为实体写入付费,外加针对内置索引以及任何复合索引的每个属性 4 次写入(删除旧值并插入新值)。

关于google-app-engine - Google 将什么归类为 Google App Engine 中的数据存储写入操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8113363/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com