【发布时间】:2016-02-07 20:37:54
【问题描述】:
我经常想要进行两个或多个独立查询以从 Datastore 中获取实体。但我不确定它们是否真的平行。例如:
loadResult1 = ofy().load().key(Key.create(Foo.class, 1));
loadResult2 = ofy().load().key(Key.create(Bar.class, 1));
loadResult1.now();
loadResult2.now();
这样安排代码有什么好处吗?
搜索查询也是如此
iterable1 = ofy().load().type(Foo.class).iterable();
iterable2 = ofy().load().type(Bar.class).iterable();
iterable1.hasNext();
iterable2.hasNext();
iterable2 会与 iterable1 并行加载吗?
附带问题:.iterable() 在这方面与.list() 有什么不同吗?
我尝试调试代码,但在调用.now() 或第一次调用.next()/.hasNext() 之前似乎没有调用。真的如此吗?
【问题讨论】:
标签: google-app-engine google-cloud-datastore objectify