Recall & Review
beginner
What does the Redis command
SISMEMBER do?It checks if a given element is a member of a specified set and returns 1 if true, 0 if false.
Click to reveal answer
beginner
How do you use
SISMEMBER to check if 'apple' is in the set 'fruits'?Use the command:
SISMEMBER fruits apple. It returns 1 if 'apple' is in 'fruits', otherwise 0.Click to reveal answer
beginner
What type of data structure does
SISMEMBER work with in Redis?SISMEMBER works only with sets, which are unordered collections of unique elements.Click to reveal answer
beginner
What is the return value of
SISMEMBER if the element is not found in the set?It returns 0, indicating the element is not a member of the set.
Click to reveal answer
intermediate
Can
SISMEMBER be used on Redis data types other than sets?No,
SISMEMBER only works with sets. Using it on other types will cause an error.Click to reveal answer
What does the Redis command
SISMEMBER myset value return if 'value' is in 'myset'?✗ Incorrect
SISMEMBER returns 1 if the element is a member of the set.Which Redis data type is required for
SISMEMBER to work?✗ Incorrect
SISMEMBER only works with sets.What does
SISMEMBER return if the element is not in the set?✗ Incorrect
It returns 0 to indicate the element is not a member.
If you run
SISMEMBER on a key that does not exist, what is the result?✗ Incorrect
If the set does not exist, Redis treats it as empty and returns 0.
Which of the following commands checks membership in a Redis set?
✗ Incorrect
SISMEMBER is the command to check membership in a set.Explain how the Redis command
SISMEMBER works and what it returns.Think about checking if an item is in a group.
You got /4 concepts.
Describe a real-life example where you might use
SISMEMBER in Redis.Imagine checking if a friend is in your contact list.
You got /4 concepts.