Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Smembers Command

Redis Smembers Command

Redis Set

The Redis Smembers command returns all members in the set. A non-existent set key is treated as an empty set.

Syntax

The basic syntax of the redis Smembers command is as follows:



redis 127.0.0.1:6379> SMEMBERS key

Available Version

= 1.0.0

Return Value

All members in the set.

Example



redis 127.0.0.1:6379> SADD myset1 "hello"

(integer) 1

redis 127.0.0.1:6379> SADD myset1 "world"

(integer) 1

redis 127.0.0.1:6379> SMEMBERS myset1

1) "World"

2) "Hello"

Redis Set