sls
SLS
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Get values by pattern
Usage is sls key value.
You can use a glob-style pattern for the value.
- * : matches any characters: h*llo -> hllo, heeeello, etc
- ? : matches one character: h?llo -> hallo, hello, hxllo, etc
- [alphabet] : matches a character in the brackets: h[ae]llo -> hallo, hello
- [^e] : matches characters except those in the brackets:
h[^e]llo -> hallo, hbllo, ... but hello is excluded.
- [a-c] : matches a character range in the brackets: h[a-c]llo -> hallo, hbllo, hcllo
- \ : to use the special characters (*?[^]) as literals, put \ in front.
Example
| Command> | sadd myset value11 value12 value21 value22 |
| Result> | 4 |
| Command> | sls myset * |
| Result> |
1) value12 2) value11 3) value22 4) value21 |
| Command> | sls myset value1* |
| Result> |
1) value12 2) value11 |
Sort feature
sort or asc sorts in ascending order; desc sorts in descending order.
Example
| Command> | sls myset * sort |
| Result> |
1) value11 2) value12 3) value21 4) value22 |
Syntax
SLS key pattern [sort|asc|desc]
- Available since Enterprise version 6.1.0.
- Time complexity is O(N). N is the number of values.
- Be careful when there are many values, because it can affect performance.
| << SMEMBERS | SLS | SCARD >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
