TimeStamp所有行都是唯一的吗?
它有独特的索引吗?
我正在为我正在开发的移动应用程序设计RESTful API.我的问题是包含许多项目的大型集合.我知道一个好的做法是在集合中对大量结果进行分页.
我已经阅读了Facebook Graph API文档(https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2),Twitter游标文档(https://dev.twitter.com/概述/ api/cursoring),GitHub API doc(https://developer.github.com/v3/)和这篇文章(API分页最佳实践).
考虑/resources我的API中的示例集合,其中包含100个名为resource1to resource100和sorted descending的项目.这是您在GET请求时得到的响应(GET http://api.path.com/resources?limit=5):
{
"_links": {
"self": { "href": "/resources?limit=5&page=1" },
"last": { "href": "/resources?limit=5&page=7" },
"next": { "href": "/resources?limit=5&page=2" }
},
"_embedded": {
"records": [
{ resource 100 },
{ resource 99 },
{ resource 98 },
{ resource 97 },
{ resource 96 }
]
}
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是这样的场景:
1- I获取/resources上述内容.
2-之后,会向资源集合添加一些内容(例如,另一台设备会为此帐户添加新资源).所以现在我有101个资源.
3- …
rest pagination api-design mobile-application restful-architecture
在查看时Pagination,出现了渲染复杂页面的问题。API示例等。,通常指定pageFactory每次调用时简单构造一个新控件的 a。事实上,在分页时对下面的示例进行分析显示内存压力最小,并且迅速收集了一系列新实例。如果日益复杂的情况改变了情况,我该怎么办?
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Pagination;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
/** @see /sf/ask/5345178331/ */
public class PaginationSample extends Application {
private static final int N = 100;
private record Item(String name, Color color) {
private static final Random r = new Random();
public static Item ofRandom() …Run Code Online (Sandbox Code Playgroud) pagination ×3
api ×1
api-design ×1
cursor ×1
facebook ×1
java ×1
javafx ×1
renderer ×1
rest ×1
sql ×1
sql-server ×1
timestamp ×1
twitter ×1