SRM

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

Delete values by pattern

Usage is srm key val*.
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>srm myset value1*
Result>2
Command>sls myset *
Result> 1) value22
2) value21

Syntax

SRM key pattern

  • Available since Enterprise version 6.1.0.
  • Time complexity is O(N). N is the number of values.

<< SREM SRM SMEMBERS >>

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