lpush_subquery
LPUSHS (subquery)
Subquery feature
You can insert values 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> | lpushs mylist (get key) |
| Result> | 1 |
| Command> | lrange mylist 0 -1 |
| Result> | 1) "Hello" |
You can insert multiple values using various commands in the subquery.
Example
| Command> | lpushs mylist (lrange mylist2 0 -1) |
| Result> | 9 |
| Command> | lpushs mylist (sunion myset1 myset2) |
| Result> | 16 |
| Command> | lpushs mylist (zrange myzset1 0 -1) |
| Result> | 22 |
| Command> | lpushs mylist (hmget myhash1 field1 field2) |
| Result> | 24 |
You can use multiple subqueries.
Example
| Command> | lpushs mylist (lrange mylist2 0 -1) (sunion myset1 myset2)
value1 |
| Result> | 17 |
Syntax
LPUSHS key (subquery)
- Available since Enterprise version 7.2.5.
- Time complexity depends on the subquery.