Re:Redis Lua scripting implemented: how to play with it.
by wolfhumble on Monday May 02, 2011 @09:30AM
(#2506165)
Would this work like a stored procedure in e.g. MySQL, though with the disadvantage that it will not actually be stored within Redis and the advantage that it uses a more powerful language, Lua?
[ Parent
| on HN ]
Re:Redis Lua scripting implemented: how to play with it.
by Twisol on Monday May 02, 2011 @08:44PM
(#2508526)
It looks that way. I've been playing with it and I've found two ways to actually store and reuse scripts though:
1) Use loadstring() to compile and run a script from a Redis key. EVAL "return loadstring(redis('get', KEYS[1]))()" 1 foo
2) Set a function as a global value, and call that. EVAL "myfunc = function() return 42" 0 EVAL "return myfunc()" 0
antirez said in his previous post (http://antirez.com/post/redis-and-scripting.html) that storing scripts has some problems with regard to Redis Cluster, though.