ZLS

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Query values by pattern

Usage: zls key value.
You can use a glob-style pattern for the value.
Scores are not returned.

  • * : Matches any characters: h*llo -> hllo, heeeello, etc
  • ? : Matches one character: h?llo -> hallo, hello, hxllo, etc
  • [alphabet] : Matches a character inside the brackets: h[ae]llo -> hallo, hello
  • [^e] : Matches any character except those in the brackets: h[^e]llo -> hallo, hbllo,... but hello is excluded.
  • [a-c] : Matches a character range inside the brackets: h[a-c]llo -> hallo, hbllo, hcllo
  • \ : To use the special characters (*?[^]) literally, prefix them with \.

Example

Command>zadd key 11 value11 12 value12 21 value21 22 value22
Result>4
Command>zls key *
Result> 1) value11
2) value12
3) value21
4) value22
Command>zls key value1*
Result> 1) value11
2) value12

Sort option

Use Sort or asc for ascending order, and desc for descending order.

Example

Command>zls key * desc
Result> 1) value22
2) value21
3) value12
4) value11

Syntax

ZLS key pattern [sort|asc|desc]

  • Available since Enterprise version 6.1.0.
  • Time complexity is O(N). N is the number of items.
  • Be careful when there are many values, because it can affect performance.

<< ZRANGESTORE ZLS ZREVRANGE >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.