UK[skæn] 美[skæn]

vt.<calculation>scan; take a closer look; scrutinize; (radar) scan...

n.Scan; browse ; examine; (radar) (light spot on the screen)

vi. (beam, radar, etc.) scan; scan; (poetry) conform to the rhythm; mark the rhythm of the poem

Third person singular: scans Plural: scans Present participle: scanning Past tense: scanned Past participle: scanned

redis SCAN command syntax

Function: The SCAN command is a cursor based iterator: Every time the SCAN command is called, a new cursor will be returned to the user, which the user needs to use in the next iteration. This new cursor is used as the cursor parameter of the SCAN command to continue the previous iteration process.

Syntax: SCAN cursor [MATCH pattern] [COUNT count]

Description: When the cursor parameter of the SCAN command is set to 0, The server will start a new iteration, and when the server returns a cursor with a value of 0 to the user, it means that the iteration has ended.

Available versions: >= 2.8.0

Time complexity: The complexity of each execution of the incremental iteration command is O (1), the complexity of a complete iteration of the data set is O(N), where N is the number of elements in the data set.

Return:

The SCAN command, SSCAN command, HSCAN command and ZSCAN command all return a multi-bulk reply containing two elements: the first element of the reply is an unsigned 64-bit integer (cursor) represented by a string. The second element of the reply is another multi-bulk reply. This multi-bulk reply contains the element being iterated this time. Each element returned by the SCAN command is a database key. Each element returned by the SSCAN command is a set member. Each element returned by the HSCAN command is a key-value pair, and a key-value pair consists of a key and a value. Each element returned by the ZSCAN command is an ordered set element. An ordered set element consists of a member and a score.

redis SCAN command example

redis 127.0.0.1:6379> scan 0 MATCH *11*
1) "288"
2) 1) "key:911"
redis 127.0.0.1:6379> scan 288 MATCH *11*
1) "224"
2) (empty list or set)
redis 127.0.0.1:6379> scan 224 MATCH *11*
1) "80"
2) (empty list or set)
redis 127.0.0.1:6379> scan 80 MATCH *11*
1) "176"
2) (empty list or set)
redis 127.0.0.1:6379> scan 176 MATCH *11* COUNT 1000
1) "0"
2)  1) "key:611"
    2) "key:711"
    3) "key:118"
    4) "key:117"
    5) "key:311"
    6) "key:112"
    7) "key:111"
    8) "key:110"
    9) "key:113"
   10) "key:211"
   11) "key:411"
   12) "key:115"
   13) "key:116"
   14) "key:114"
   15) "key:119"
   16) "key:811"
   17) "key:511"
   18) "key:11"