RPUSHS (subquery)

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

Subquery feature

You can insert values by using a subquery in the value 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.

Example

Command>set key Hello
Result>OK
Command>rpushs mylist (get key)
Result>1
Command>lrange mylist 0 -1
Result>1) "Hello"

  • You can insert multiple values using various commands in a subquery.
  • Example

    Command>rpushs mylist (lrange mylist2 0 -1)
    Result>9
    Command>rpushs mylist (sunion myset1 myset2)
    Result>16
    Command>rpushs mylist (zrange myzset1 0 -1)
    Result>22
    Command>rpushs mylist (hmget myhash1 field1 field2)
    Result>24

  • You can use the same key in the subquery.
  • Example

    Command>rpushs mylist (lpop mylist)
    Result>10

  • You can use multiple subqueries.
  • Example

    Command>rpushs mylist (lrange mylist2 0 -1)   (sunion myset1 myset2)   value1
    Result>17
    Available since Enterprise version 7.2.5 .

    Syntax

    RPUSHS key (subquery)

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

    << RPUSH RPUSHS LRANGE >>

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