sscan count does not work correctly
hahahashen opened this issue · comments
hahahashen commented
debing.sun commented
please read the section Number of elements returned at every SCAN call
in https://redis.io/commands/scan/
SCAN family functions do not guarantee that the number of elements returned per call are in a given range. The commands are also allowed to return zero elements, and the client should not consider the iteration complete as long as the returned cursor is not zero.
However the number of returned elements is reasonable, that is, in practical terms SCAN may return a maximum number of elements in the order of a few tens of elements when iterating a large collection, or may return all the elements of the collection in a single call when the iterated collection is small enough to be internally represented as an encoded data structure (this happens for small Sets, Hashes and Sorted Sets).
However there is a way for the user to tune the order of magnitude of the number of returned elements per call using the COUNT option.
hahahashen commented
I see. It means, redis does not guarantee that the number of the return elements is less than count?
debing.sun commented
yes, it can be less or more.
hahahashen commented
I understand, thank you!