Hash

HSCAN

Scan a hash for fields.

Arguments

keybodystrrequired

The key of the hash.

cursorbodyintrequired

The cursor, use 0 in the beginning and then use the returned cursor for subsequent calls.

matchbodystr

Glob-style pattern to filter by field names.

countbodyint

Number of fields to return per call.

Response

Tuple[number, List[str]]required

The new cursor and the fields. If the new cursor is 0 the iteration is complete.

Basic
# Get all members of a hash.cursor = 0results = []while True:    cursor, keys = redis.hscan("myhash", cursor, match="*")    results.extend(keys)    if cursor == 0:        break
Loading search…