Redis SSCAN命令

2019-10-16 22:51:53

Redis SSCAN命令遍歷集合儲存在指定的鍵的元素。

返回值

返回陣列

語法

redis SSCAN命令的基本語法如下所示:

redis 127.0.0.1:6379> SSCAN KEY [MATCH pattern] [COUNT count]

範例

redis 127.0.0.1:6379> SADD myset1 "hello"
(integer) 1
redis 127.0.0.1:6379> SADD myset1 "hi"
(integer) 1
redis 127.0.0.1:6379> SADD myset1 "bar"
(integer) 1
redis 127.0.0.1:6379> sscan myset1 0 match h*
1) "0"
2) 1) "hello"
   2) "h1"