与Cassandra的分页的语用学
对于用卡桑德拉(Cassandra)的使用实施分页,这更像是一个务实的问题。我已经阅读了有关页面状态的文档,并且不应将其暴露给最终用户,因为它没有加密并创造了不必要的篡改的可能性。
因此,话虽如此,我的问题是,在实现需要在滚动时需要获取下一个记录的API时,使用Pagestate对象有什么用法和最佳实践?
This is more of a pragmatical question in regards to implementing pagination with the usage of Cassandra. I have read the documentation in regards to the Page state and that it should not be exposed to end user as it is not encrypted and creates the possibility of unwanted tampering.
So, with all that said, my question is what are the pragmatics and best practices in terms of using the PageState object when implementing an API that needs to fetch the next records in line upon scrolling?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重新阅读了您的问题后,我想我现在了解您要实现的目标。
您是正确的,说您不应该将页面状态暴露于应用程序的最终用户。我认为,如果用户修改/篡改页面状态,我不会发生任何灾难性的事情,但是如果这样做,它将返回不可预测的结果,或者是无法使用的,并且驾驶员会引发例外。
在您实施API检索下一个结果“页面”时,最佳实践的问题是什么,我建议将您的API的实现与请求从数据库中要求记录的逻辑分开。
例如,请勿在API中使用驱动程序的页面状态,而是实现一个选项
page = next
,因此HTTP Endpoint看起来像/api/users?page = page = next
。干杯!After re-reading your question, I think I understand now what you're trying to achieve.
You are correct in saying that you shouldn't expose the page state to end-users of your application. I don't think there will be anything catastrophic if the page state is modified/tampered by a user but if they do, it will either return unpredictable results or be unusable and the driver will throw an exception.
On your question of what is best practice when implementing an API to retrieve the next "page" of results, I would recommend separating the implementation of your API from the logic which requests the records from the DB.
For example, don't use the driver's page state in your API but instead implement an option
page=next
so the HTTP endpoint looks like/api/users?page=next
. Cheers!