user2979640
user2979640

Reputation: 69

Lua script for redis transaction

Is there a way to use MULTI & EXEC command in lua? If not how to perform >transaction using lua script

Upvotes: 3

Views: 4225

Answers (1)

Liviu Costea
Liviu Costea

Reputation: 3774

Lua scripts are atomically executed, so while they run there is no other thread/process changing your data (because Redis is single threaded). You can think of it as only one redis command. So you should be able to do with a simple Lua script whatever you wanted to put in transaction.
Also you can check Redis Scripting and Transactions where it is mentioned that it is a possibility that transactions support will be removed in the far future because they can be replaced by scripts only.

Upvotes: 8

Related Questions