RMS (subquery)

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

Subquery feature

You can delete keys by using a subquery in the key part.
Commands that can be used as a subquery are GET, MGET, LPOP, RPOP, LRANGE, SMEMBERS, SUNION, SINTER, SDIFF, ZRANGE, ZREVRANGE, HGET, HMGET, HKEYS, HVALS, HGETALL, KEYS, LS.

Example

Command>set mykey myvalue
Result>OK
Command>set key mykey
Result>OK
Command>rms (get key)
Result>1

  • You can delete multiple keys.
  • Example

    Command>lpush mylist mykey1 mykey2 mykey3
    Result>3
    Command>rms (lrange mylist 0 -1)
    Result>3

  • You can use the ls command.
  • Example

    Command>rms (ls user*)   delete keys starting with user  
    Result>10
    Command>rms (ls * string)   delete all keys whose data type is string  
    Result>20
    Command>rms (ls * count 10)   delete 10 arbitrary keys  
    Result>10

  • You can use multiple subqueries.
  • Example

    Command>rms (lrange mylist 0 -1)   (sunion myset1 myset2)   mykey10
    Result>10
    The RMS command is available in Enterprise version 7.2.5.

    Syntax

    RMS (subquery)

    • Available since Enterprise version 7.2.5.
    • Time complexity is O(N). N is the number of keys to delete.
    Related commands DEL

    << RM RMS KEYS >>

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