Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Latest commit

 

History

History
58 lines (40 loc) · 2.02 KB

File metadata and controls

58 lines (40 loc) · 2.02 KB
code type title description
true
page
scan
MemoryStorage:scan

scan

Iterates incrementally over the set of keys in the database using a cursor.

An iteration starts when the cursor is set to 0.
To get the next page of results, simply re-send the identical request with the updated cursor position provided in the result set.
The scan terminates when the next position cursor returned by the server is 0.

[Redis documentation]


scan(cursor, [options], callback)

Arguments Type Description
cursor int Page number (iteration starts with a cursor value of 0, and ends when the next cursor position is 0)
options JSON Object Optional parameters
callback function Callback

Options

Option Type Description Default
count int Return the approximate count number of items per result page 10
match string Search only for field names matching the provided pattern *
queuable boolean Make this request queuable or not true

Callback Response

Returns a JSON object containing 2 entries:

  • the cursor position for the next page of results (a next position of 0 indicates the end of the scan)
  • a list of fetched keys

Usage

<<< ./snippets/scan-1.php

Callback response:

{
  "cursor": 18,
  "values": ["key1", "key2", "..."]
}