Commands
>
SCAN

SCAN

Syntax

SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]

Description

Iterate over all keys in the cache.

Options

  • cursor - The iterator cursor. Use zero to start a new iterator beginning with the first known key. The server will return a non-zero cursor when there are more results, which should be used to continue iterating until the server returns zero.
  • MATCH pattern - Only return keys that match the provided pattern, such as 'user:*'.
  • COUNT count - Limit the number of keys returned.
  • TYPE type - Return a certain key type. Currently only 'string' is allowed.

Example

> SET user:983:first Tom
> SET user:983:last Anderson
> SET user:983:id 9918223
> SET user:983:age 32
> SCAN 0

Related Commands