开发者

Fetching the nth element from app engine datastore

I'm looki开发者_开发百科ng for a effective and scalable way of doing the following with the java low level API. I have a query with some sort orders and i would like to fetch the Nth entity. Using the offset argument doesn't seem like a good idea.

EDIT Background: I'm trying to write an abstraction layer for DS with a Memcache. The data stored in the datastore should be arbitrary. Examples of methods: getEntity(key) AddEntity(entity) getEntityByIndex(index, sort)

Any suggestions are appreciated.


Using an offset is the only way to do this if the only information you have is the index of the element. As you observe, this isn't efficient (on any database, not just the Datastore).

Depending on your situation, though, you may be able to use an alternate solution, such as datastore cursors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜