sets_intro
SETS Intro
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Introduction
In Sets, a key and values have a one-to-many relationship.
Values are stored regardless of insertion order and are unique. If value A is stored twice, only one remains.
In Sets, a value is called a member because it is a set.
Sets are mainly used in games such as card games, or wherever set operations are needed.
Values are stored regardless of insertion order and are unique. If value A is stored twice, only one remains.
In Sets, a value is called a member because it is a set.
Sets are mainly used in games such as card games, or wherever set operations are needed.
Command summary
- SET: SADD, SMOVE
- GET: SMEMBERS, SCARD, SRANDMEMBER, SISMEMBER, SSCAN
- POP: SPOP
- REM: SREM
- Set operations: SUNION, SINTER, SDIFF, SUNIONSTORE, SINTERSTORE, SDIFFSTORE
- Enterprise: SLS, SRM, SLEN
| Commands | Version | Syntax | Description |
|---|---|---|---|
| SADD | 1.0.0 | key member [member ...] | Add members to a set |
| SREM | 1.0.0 | key member [member ...] | Remove members from a set |
| SMEMBERS | 1.0.0 | key | Get all members of a set |
| SCARD | 1.0.0 | key | Get the number of members in a set |
| SUNION | 1.0.0 | key [key ...] | Get the union |
| SINTER | 1.0.0 | key [key ...] | Get the intersection |
| SDIFF | 1.0.0 | key [key ...] | Get the difference |
| SUNIONSTORE | 1.0.0 | dest_key src_key [src_key ...] | Store the union in a new set |
| SINTERSTORE | 1.0.0 | dest_key src_key [src_key ...] | Store the intersection in a new set |
| SDIFFSTORE | 1.0.0 | dest_key src_key [src_key ...] | Store the difference in a new set |
| SISMEMBER | 1.0.0 | key member | Check whether a member exists in a set |
| SMOVE | 1.0.0 | src_key dest_key member | Move a member from the source set to the destination set |
| SPOP | 1.0.0 | key [count] | Remove and return a random member from a set |
| SRANDMEMBER | 1.0.0 | key [count] | Get a random member from a set |
| SSCAN | 2.8.0 | key cursor [MATCH pattern] [COUNT count] | Iterate members in batches |
| SMISMEMBER | 6.2.0 | key member [member ...] | Check whether members exist in a set - multiple members |
| SLS | Ent 6.0.0 | key pattern | Get values by pattern |
| SRM | Ent 6.0.0 | key pattern | Delete values by pattern |
| SLEN | Ent 7.0.0 | key | Return the number of members in a key |
Total : 19
Sets command overview
Redis Internal : SET internal data structure
SET data structure
-
INTSET: a data structure that saves memory when SET members are integers
See the data structure, how much memory it saves, and how it performs.
PDF manual
| << BRPOPLPUSH | SETS Introduction | SADD >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
