Back to Redis

EXEC

content/commands/exec.md

latest1.7 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 >}}

Executes all previously queued commands in a transaction and restores the connection state to normal.

When using [WATCH]({{< relref "/commands/watch" >}}), EXEC will execute commands only if the watched keys were not modified, allowing for a check-and-set mechanism.

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="exec-return-info" tab1="RESP2" tab2="RESP3" >}}

One of the following:

  • Array reply: each element being the reply to each of the commands in the atomic transaction.
  • Nil reply: the transaction was aborted because a WATCHed key was touched.

-tab-sep-

One of the following:

  • Array reply: each element being the reply to each of the commands in the atomic transaction.
  • Null reply: the transaction was aborted because a WATCHed key was touched.

{{< /multitabs >}}