LLS

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

Get values by a pattern

The usage is lls key value.
You can use a glob-style pattern for 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 any character 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 above (*?[^]) as literals, prefix them with \.

Example

Command>lpush mylist value11 value12 value21 value22
Result>4
Command>lls mylist *
Result> 1) value22
2) value21
3) value12
4) value11
Command>lls mylist value1*
Result> 1) value12
2) value11

Sort feature

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

Example

Command>lls mylist * sort
Result> 1) value11
2) value12
3) value21
4) value22

Syntax

LLS key pattern [sort|asc|desc]

  • Available since Enterprise version 6.1.0.
  • Time complexity is O(N). N is the number of data items.
  • If there are many values or compression is used, it can affect performance, so use it carefully.

<< LRANGE LLS LREVRANGE >>

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