HSETS (subquery)

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

Subquery feature

You can set values using a subquery in the field value part.
Commands that can be used as a subquery are GET, MGET, HGET, HMGET, and HGETALL.
For GET and MGET, the key is used as the field.

Example

Command>set key Hello
Result>OK
Command>hsets myhash (get key)
Result>1
Command>hgetall myhash
Result>1) "key"
2) "Hello"

  • You can set multiple values by using various commands in the subquery.
  • Example

    Command>hsets myhash (mget key1 key2)
    Result>2
    Command>hsets myhash (hget myhash1 field)
    Result>1
    Command>hsets myhash (hmget myhash1 field1 field2)
    Result>2
    Command>hsets myhash (hgetall myhash2)
    Result>10

  • Only one subquery can be used.
  • This command is available from Enterprise version 7.2.5 .

    Automatic member deletion (expiration) feature

    It can also be used with a subquery.

    Example

    Command>hsets myhash (get key) ex 10
    Result>1
    Command>hsets myhash (hgetall myhash2) ex 10
    Result>10

    Syntax

    HSETS key (subquery)   [ex seconds]

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

    << HSET HSETS HDEL >>

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