Redis Zscan Command

Redis Sorted Set

The Redis Zscan command is used to iterate over elements in a sorted set (including element members and element scores)

Syntax

The basic syntax of the Redis Zscan command is as follows:

redis 127.0.0.1:6379> ZSCAN key cursor [MATCH pattern] [COUNT count]
  • cursor - Cursor.
  • pattern - The pattern to match.
  • count - Specifies how many elements to return from the dataset, with a default value of 10.

Available Versions

>= 2.8.0

Return Value

Each returned element is a sorted set element, and a sorted set element consists of a member and a score.

Example

> ZADD site 1 "Google" 2 "Example" 3 "Taobao" 4 "Weibo"
(integer) 4
> ZSCAN site 0 match "R*"
1) "0"
2) 1) "Example"
2) 2.0

Redis Sorted Set

Other Extensions