Re:Redis Lua scripting implemented: how to play with it.
by almost on Monday May 02, 2011 @09:21AM
(#2506128)
Have a look at the bottom of the article, antirez suggests that a EVALSHA command might be implemented that would allow specification of a script by a SHA1 hash.
Seems like a good idea to get the rest of it sorted before deciding on that bit though.
Re:Redis Lua scripting implemented: how to play with it.
by StavrosK on Monday May 02, 2011 @09:37AM
(#2506197)
That's what I was thinking as well. The question is, can redis (or lua, I guess) eval a script stored as a string? I imagine you would issue a redis EVAL where the script would be the Lua "eval(mykey)", is that possible?
Basically, 1) does Lua have an "eval" statement and 2) can Redis' EVAL read keys (I assume it can, since that's pretty much what the post says)?
Re:Redis Lua scripting implemented: how to play with it.
by unsigner on Monday May 02, 2011 @09:45AM
(#2506230)
1) yes, it has, loadstring() turns a string into an anonymous function which can then be called at will.
2) yes
So it seems you can set up your own stored procedures.
Re:Redis Lua scripting implemented: how to play with it.
by brianm on Monday May 02, 2011 @12:33PM
(#2506809)
Tokyo Tyrant (and Kyoto Tyrant) have a pretty nice mechanism for doing this, http://fallabs.com/tokyotyrant/spex.html#luaext
Basically you give it a "-ext /path/to/waffles.lua" arg at startup to define a bunch of user defined functions.
Re:Redis Lua scripting implemented: how to play with it.
by antirez on Monday May 02, 2011 @12:40PM
(#2506840)
This is the obvious choice, but we are in the cloud now ;) I feel like it's better if all the instances are the same regardless of the configuration. That's the whole point for not taking this path.
Re:Redis Lua scripting implemented: how to play with it.
by brianm on Monday May 02, 2011 @02:15PM
(#2507244)
Even in the magical cloud, you still have configuration -- listening port at a minimum. Cloud does not remove need for deployment management, as a rule.
Re:Redis Lua scripting implemented: how to play with it.
by moe on Monday May 02, 2011 @10:40PM
(#2508774)
Why do you argue against someone who's set to go the extra-mile to make life easier for us?
Inflexible configuration mechanisms are one of the top pain points in cluster-environments (cloud or not). Kudos to antirez for realizing that and working against it.
Re:Redis Lua scripting implemented: how to play with it.
by brianm on Tuesday May 03, 2011 @12:32PM
(#2510647)
I don't see how your argument follows, but... there is nothing "inflexible" about that setup, imho. I think antirez has a pretty good setup, but without poking around for edges, you won't find the edges :-)
That said, if Redis can EVAL a script stored as a String or a Hash->Key, the client can deal with registering and versioning scripts.
Awesome work btw - been looking forward to scripting in Redis for a long time