w3resource

Redis Sets: SMEMBERS

SMEMBERS key

Redis SMEMBERS command is used to return all the members of the set value stored at key.

Syntax:

SMEMBERS KEY 

Available since:

1.0.0.

Return Value:

Array reply : all elements of the set.

Return Value Type:

Array

Example: Redis SMEMBERS

127.0.0.1:6379> SADD mycolor1 "red" "green" "blue"
(integer) 3
127.0.0.1:6379> SADD mycolor1 "orange" "yellow"
(integer) 2
127.0.0.1:6379> SMEMBERS  mycolor1
1) "blue"
2) "orange"
3) "green"
4) "red"
5) "yellow"


Follow us on Facebook and Twitter for latest update.