Hi!
I'm saving my objects (for example Users) in redis by LUA script in an atomic way with EVAL command ( in "user" example I'm checking that username is unique && than save user);
Now I need to save few users in a batch and be sure that all users a saved in transaction ( eg if I need to save user1 && user2 in a batch and if I have redis crash between user1 and user2 save operation ( sure this can happen with redis only if server os is killed ;) ) none of the users will be saved;
So is it a good idea to combine MULTI\EXEC && EVAL commands together to achieve this behavior?
I have test this scenario and looks like it works as expected but I have never see that someone use this...
To test this I use the following:
to start redis:
redis-server --appendfsync always --appendonly yes
var script1 = 'redis.call("set",1,1);';
var script2 = 'return redis.call("set",1,2);';
multi.EVAL(script1,0);
multi.DEBUG("SEGFAULT");
multi.EVAL(script2,0);
multi.EXEC();
Many thanks for your time && help!
--
Max