Back to Redis

ZRANGESTORE

content/commands/zrangestore.md

latest1.3 KB
Original Source

{{< note >}} This command's behavior varies in clustered Redis environments. See the [multi-key operations]({{< relref "/develop/using-commands/multi-key-operations" >}}) page for more information. {{< /note >}}

This command is like [ZRANGE]({{< relref "/commands/zrange" >}}), but stores the result in the <dst> destination key.

Examples

{{% redis-cli %}} ZADD srczset 1 "one" 2 "two" 3 "three" 4 "four" ZRANGESTORE dstzset srczset 2 -1 ZRANGE dstzset 0 -1 {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="zrangestore-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the number of elements in the resulting sorted set.

-tab-sep-

Integer reply: the number of elements in the resulting sorted set.

{{< /multitabs >}}