Closed guaicaiboshi closed 9 months ago
Right. That is indeed not what that property means. Rather, that simply stores the passed in paging hint used on the API, but this is not a hard rule (hence "hint") - the server gives whatever it wants per page, which can be zero or higher than the hint.
Also, you've done a ToArray() on the result, which will enumerate all pages and give you everything. The page parameters here impact what happens in the background - but changing the page size shouldn't change that you get all records back. That again : is not what that is intended to do.
If you're after the first N records: perhaps use the LINQ method .Take(N)
. Because of how SE.Redis scanning works, this will be done efficiently (it won't fetch everything then discard most of it)
Also, you've done a ToArray() on the result, which will enumerate all pages and give you everything. The page parameters here impact what happens in the background - but changing the page size shouldn't change that you get all records back. That again : is not what that is intended to do.
If you're after the first N records: perhaps use the LINQ method
.Take(N)
. Because of how SE.Redis scanning works, this will be done efficiently (it won't fetch everything then discard most of it)
Thank you very much, the LINQ method .Take(N)
works perfectly.
I expected to pageSize to return the number of entries, but it failed![image](https://github.com/StackExchange/StackExchange.Redis/assets/2748771/398c867c-57da-481a-933c-600d7b44ce41)