February 2018
Intermediate to advanced
382 pages
11h 33m
English
The maximum number of fields that can be put in a hash is 232 -1. If there are a large number of fields in a hash, executing the HGETALL command may block the Redis Server. In this case, we can use HSCAN to incrementally retrieve all the fields and values.
HSCAN is one of the Redis SCAN commands (SCAN, HSCAN, SSCAN, ZSCAN), which incrementally iterate over elements, and therefore do not block the server. The command is a cursor-based iterator, so you need to specify a cursor each time when calling the command, and the starting cursor is 0. When the command is finished, Redis returns a list of elements along with a new cursor, which can be used in the next iteration.
HSCAN can be called in the following format:
Read now
Unlock full access