dk40149 :
I have a lua script like this that does an hgetall command on a remote redis cluster:
String shaFindAccount = syncCommands.scriptLoad("local hgetAllKeys = function(key) \n" +
"local acc = redis.call('HGETALL', key)\n" +
"return acc\n" +
"end\n");
I want to pass a variable to the hgetall call. This is what my eval statement, calling the above script, looks like:
list = syncCommands.evalsha(shaFindAccount, ScriptOutputType.MULTI, key);
Where key
is a unique identifier (primary key) of acc. Right now this function returns an empty list.
How do I pass a java variable into the above lua script with io.lettuce.core
? (There are no connection issues, i can use a similar query with a hardcoded key
value and it works)
m4gic :
You can find some example in this unit test. It seems you should call it in this way:
list = syncCommands.evalsha(digest, MULTI, new String[0], key));
and you should refer the argument as ARGV[1].