2
votes

I want to replace MULTI/EXEC operation in Redis, with Lua script call, and according to documentation of scripting in Redis:

Redis uses the same Lua interpreter to run all the commands. Also Redis guarantees that a script is executed in an atomic way: no other script or Redis command will be executed while a script is being executed. This semantics is very similar to the one of MULTI / EXEC. From the point of view of all the other clients the effects of a script are either still not visible or already completed.

As I understand I can drop MULTI/EXEC in this case and simplify my procedure, or is it more complicated, then this, and I still need to use it just in case? (For example for cluster environment)

1

1 Answers

3
votes

In general, with a Lua script, you can drop MULTI/EXEC, provided the MULTI/EXEC block was only used to enforce isolation (isolation as in ACID).

A cluster environment does not change anything, since MULTI/EXEC blocks only work at the instance level.