DELS (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 position.
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>dels (get key)
Result>1

  • You can delete multiple keys.
  • Example

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

  • You can use the ls command.
  • Example

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

  • You can use multiple subqueries.
  • Example

    Command>dels (lrange mylist 0 -1)   (sunion myset1 myset2)   mykey10
    Result>10
    This command is available from Enterprise version 7.2.5 .

    Syntax

    DELS (subquery)

    • Available since Enterprise version 7.2.5.
    • Time complexity depends on the subquery.

    << DEL DELS GET >>

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