MCPcopy
hub / github.com/redis/redis-py / zscan_iter

Method zscan_iter

redis/commands/core.py:6294–6321  ·  view source on GitHub ↗

Make an iterator using the ZSCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns ``score_cast_func`` a callable used to cast

(
        self,
        name: KeyT,
        match: Union[PatternT, None] = None,
        count: Optional[int] = None,
        score_cast_func: Union[type, Callable] = float,
    )

Source from the content-addressed store, hash-verified

6292 yield it
6293
6294 async def zscan_iter(
6295 self,
6296 name: KeyT,
6297 match: Union[PatternT, None] = None,
6298 count: Optional[int] = None,
6299 score_cast_func: Union[type, Callable] = float,
6300 ) -> AsyncIterator:
6301 """
6302 Make an iterator using the ZSCAN command so that the client doesn't
6303 need to remember the cursor position.
6304
6305 ``match`` allows for filtering the keys by pattern
6306
6307 ``count`` allows for hint the minimum number of returns
6308
6309 ``score_cast_func`` a callable used to cast the score return value
6310 """
6311 cursor = "0"
6312 while cursor != 0:
6313 cursor, data = await self.zscan(
6314 name,
6315 cursor=cursor,
6316 match=match,
6317 count=count,
6318 score_cast_func=score_cast_func,
6319 )
6320 for d in data:
6321 yield d
6322
6323
6324class SetCommands(CommandsProtocol):

Callers

nothing calls this directly

Calls 1

zscanMethod · 0.80

Tested by

no test coverage detected