w3resource

Redis Transactions: UNWATCH

Redis UNWATCH Command

Redis UNWATCH command is used to flush all the previously watched keys for a transaction.

Here are some common uses and scenarios for the "UNWATCH" command:

  • Remove Watched Keys: Stops monitoring specific keys for changes that might affect the transaction, removing them from the list of watched keys.
  • Abort Conditional Execution: Allows for aborting a transaction if changes to watched keys are detected, ensuring transaction integrity.
  • Transaction Management: Provides a way to manage and adjust key monitoring during a transaction, enabling more flexible transaction handling.
  • Prevent Rollback: Prevents automatic rollback of a transaction if watched keys are modified, allowing for conditional command execution.

Syntax:

UNWATCH 

Available since

2.2.0.

Return Value

Simple string reply: always OK.

Return Value Type

String

Previous: MULTI
Next: WATCH



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/redis/redis-unwatch.php