官方文档
A Page knows about the total number of elements and pages available. It does so by the infrastructure triggering a count query to calculate the overall number. As this might be expensive (depending on the store used), you can instead return a Slice. A Slice only knows about whether a next Slice is available, which might be sufficient when walking through a larger result set.
大概的意思就是说Page
实现了获取所有记录的数量和页面的总数,但是它是通过count query
来计算的,所以这个代价就是很大的。
所以,当我们有一个很大
的数据集的时候,Slice
可能就能满足我们的需求了。因为大多数时候,我们并不需要知道结果集总数是多少。