Redis Sets: SISMEMBER
Redis SISMEMBER Command
Redis SISMEMBER command is used to return the member, which is the member of the set stored at key.
Here are some common uses and scenarios for the "SISMEMBER" command:
- Membership Check: Verify if a specific element is present in a set.
- Existence Validation: Validate the existence of an item within a set for various applications.
- Access Control: Implement access control by checking if a user or resource is part of a particular group or set.
- Data Integrity: Ensure data integrity by confirming the presence of an item in a set before performing operations.
- Conditional Processing: Perform conditional logic based on the presence of an item in a set.
Syntax:
SISMEMBER KEY VALUE
Available since:
1.0.0.
Return Value:
Integer reply,
- 1 if the element is a member of the set.
- 0 if the element is not a member of the set, or if the key does not exist.
Return Value Type:
Integer
Example: Redis SISMEMBER
127.0.0.1:6379> SADD mycolor "red" "green" "blue" (integer) 3 127.0.0.1:6379> SISMEMBER mycolor "green" (integer) 1 127.0.0.1:6379> SISMEMBER mycolor "orange" (integer) 0
Previous:
Redis Sets SINTERSTORE
Next:
Redis Sets SMEMBERS
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics