- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在确保数据存储区的一致性方面遇到了一个非常棘手的问题。我们正在尝试每 1 分钟 (cron) 对 BigQuery 执行一次同步作业,并依靠数据存储来存储上一次同步完成时间的时间戳。
当加载对象时,我们仍然看到最终一致性,我已经到了令人毛骨悚然的时间..
Settings 和 ParentClass 类都作为单例存储在 Datastore 中,即只有一个存在。
@Entity
public class Settings {
@Parent
private Key<ParentClass> parent = ParentClass.getKey();
@Id
private Long id = 123L;
...
public Settings save(){
ofy().cache(false).consistency(ReadPolicy.Consistency.STRONG).save().entity(this).now();
return this;
}
public static Settings get(){
Settings settings = ofy().cache(false).consistency(ReadPolicy.Consistency.STRONG).load().key(Key.create(ParentClass.getKey(), Settings.class, 123L)).now();
if (settings == null) settings = create();
return settings;
}
private static Settings create(){
return new Settings().save();
}
}
有谁知道导致最终一致的原因是什么?
编辑:web.xml 提取:
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>asyncCacheFilter</filter-name>
<filter-class>com.googlecode.objectify.cache.AsyncCacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>asyncCacheFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
最佳答案
问题是 Objectify 的内部 session 缓存。
最初通过在第一次 load() 之前使用 ofy().clear() 手动清除缓存来解决,然后通过升级到 Objectify 5.1.5 进一步改进。
关于java - 数据存储和内存缓存一致性 - Google App Engine 和 Objectify,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28632271/
我正在像这样使用 Objectify 保存一个对象: Thing th = new Thing(); th.identifier = thingId; th.name = thingName; th.
我正在像这样使用 Objectify 保存一个对象: Thing th = new Thing(); th.identifier = thingId; th.name = thingName; th.
是否可以通过仅返回特定列表字段为空的实体来过滤 objectify 中的实体? 例如,如果我有一个客户端实体,它有一个属性“地址”,属于列表类型,我如何才能只返回根本没有关联地址的客户端? 是否有某种
我正在使用 Google App engine1.9.3、Eclipse、Objectify5.03。我的类(class)如下: import com.googlecode.objectify.Ref
我从 http://code.google.com/p/objectify-appengine/downloads/list 下载了 Objectify 3.1 库,当我遵循指南时,他们说我应该用 @
我已经阅读了一些文档,但还无法与数据存储区进行通信……谁能给我一个在 GWT Web 应用程序中使用的 objectify 的示例项目/代码(我使用 eclipse)……只是一个简单的“使用 RPC
我正在尝试将 Objectify 与一组从抽象基类继承的类一起使用: class Container { @Id Long id; @Embedded Set children = new H
我正在使用 Ojectify 来存储数据存储区,我有一个实体,当我保存更改时保留它,但在浏览器中显示它有时会显示以前的数据,有时会显示新数据。 @Entity public class BrandDt
此查询有效,fullPath字段是 List : KeyLookup lookup = ofy().load().type(KeyLookup.class).filter("f
作为 Google Cloud Datastore 的新手,我想确保自己走在正确的道路上。 我需要什么: 多对多关系 关系本身必须保存描述关系的数据 两种方式都需要强一致性: 从用户实体到该用户有权访
考虑更复杂的实体结构,例如 class Entity { Float valueA; Float valueB; List properties; } class Proper
我在 Google App Engine 上使用 Objectify 5.1.1。我定义了一个名为 Insight 的 Objectify 实体,并尝试通过名为 Downloaded 的 boolea
我有三个实体:人类、狗、零食。 Treat 实体拥有 key Key ,并且 Dog 实体拥有 key Key 。当我查询 Treat 时,我想要一个包含 Dog 的实际实体的响应,并且 Dog 的实
sample Objectify code显示以默认可见性声明的实体字段,例如, public class Car { @Id Long id; String vin; int
我需要获取 datePublished IS NOT "" 的项目列表。但是,下面的代码不起作用。有任何想法吗?谢谢 Query q=ofy.query(Diagram.class).filter("
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我正在尝试有效地获取给定父实体的所有子实体。现在唯一的方法是在 objectify 中使用查询,但效率不高,因为它绕过了缓存。 Objectify-4 添加了混合查询,您可以在 Objectify 3
我正在尝试使用谷歌云端点和对象化找到一些具体示例。我已经找到了一些具有端点或对象化的,但没有一个将它们结合在一起。 最佳答案 当我开始学习 objectify 和 endpoints 时遇到了和你一样
当应用程序存储两种实体时: com.mycompany.kind.Model 和 com.mycompany.otherkind.Model 这将如何以相同类型的“模型”存储在数据存储集合中?或者不是
我想执行一个查询,获取结果,然后将光标移至下一项(如果有)。我发现的唯一相关帖子是:Objectify paging with Cursors 有没有一种方法可以在不迭代项目的情况下执行此操作? Qu
我是一名优秀的程序员,十分优秀!