Redis HSCAN Command

Redis Hash

The Redis HSCAN command is used to iterate over key-value pairs in a hash.

Syntax

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

HSCAN key cursor [MATCH pattern] [COUNT count]
  • cursor - The cursor.
  • pattern - The matching pattern.
  • 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 tuple, and each tuple consists of a field and a value.

Example

> HMSET sites google "google.com" example "example.com" weibo "weibo.com" 4 "taobao.com"
OK
> HSCAN sites 0 match "run*"
1) "0"
2) 1) "example"
2) "example.com"

Redis Hash

Other Extensions