使用物化实现良好的分页 [英] Achieve good paging using objectify

查看:102
本文介绍了使用物化实现良好的分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用objectify游标来实现基本的分页,基本上创建了一个更多按钮。如何最好的使用objectify建立允许用户去链接的分页向前和向后。更像是一个页面列表..

I'm using objectify cursors to achieve basic paging, basically creating a more button.. How best do you achieve paging using objectify for building links that allow users to go forward and backwards. Something more like a page list..

1,2,3,4,more

推荐答案

最好的办法是为整个结果集提取密钥并将其存储在会话或javascript中。每个next / previous都可以通过id加载列表中的下一个项目。按ID加载非常便宜。您可以将完整的查询结果缓存在memcache中,只要它不是太大,但这取决于您要获取的对象类型。

Your best bet is probably to fetch the keys for the entire result set and stash it in a session or in javascript. Each next/previous can load the next item in your list by id. Loading by id is very cheap. You can cache the full query results in memcache as long as it's not too large but that's going to depend on what kind of objects you're fetching.

这篇关于使用物化实现良好的分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆