0
0
Redisquery~5 mins

SMEMBERS to list all in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Redis command SMEMBERS do?
The SMEMBERS command returns all the members of a set stored at a given key in Redis.
Click to reveal answer
beginner
How do you use SMEMBERS to get all elements of a set named fruits?
You run SMEMBERS fruits. This command lists all members inside the fruits set.
Click to reveal answer
beginner
Can SMEMBERS return duplicate elements?
No, sets in Redis do not allow duplicates, so SMEMBERS returns unique members only.
Click to reveal answer
beginner
What type of data structure must the key hold to use SMEMBERS?
The key must hold a set data structure in Redis to use SMEMBERS.
Click to reveal answer
beginner
If the key does not exist, what does SMEMBERS return?
SMEMBERS returns an empty array if the key does not exist.
Click to reveal answer
What does the Redis command SMEMBERS myset return?
ADeletes the set 'myset'
BThe number of members in 'myset'
CA random member from 'myset'
DAll members of the set stored at key 'myset'
If the key does not exist, what will SMEMBERS return?
AAn empty list
BAn error
CNull
DThe string 'nil'
Which Redis data type is required to use SMEMBERS?
AString
BSet
CList
DHash
Can SMEMBERS return duplicate values?
ANo, sets do not allow duplicates
BOnly if the key is a list
COnly if the set is large
DYes, if duplicates exist
Which command would you use to get all members of a set named 'colors'?
ASADD colors
BGET colors
CSMEMBERS colors
DHGETALL colors
Explain what the Redis command SMEMBERS does and when you would use it.
Think about how you get all items from a collection that stores unique values.
You got /4 concepts.
    Describe the difference between SMEMBERS and commands that return single or count values from a set.
    Compare what each command returns about the set.
    You got /4 concepts.