Skip to content

Instantly share code, notes, and snippets.

@antirez
Created October 29, 2015 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antirez/85783d7ed171ec87c932 to your computer and use it in GitHub Desktop.
Save antirez/85783d7ed171ec87c932 to your computer and use it in GitHub Desktop.
$ cat /tmp/script.lua :luarepl*: ??
redis.call('get','foo');
redis.replicate_commands();
redis.call('set','foo',math.random());
redis.call('set','bar',math.random());
return redis.call('get','foo')
redis-cli --slave (in a different terminal)
redis-cli --eval /tmp/script.lua
"0.1252478412935733"
(slave output is the following)
"MULTI"
"set","foo","0.1252478412935733"
"set","bar","0.41615338316939465"
"EXEC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment