Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

How can I pass a variable to a Lua script from Java? (io.lettuce.core)?

$
0
0

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 aren't any connection issues, and I can use a similar query with a hard coded key value and it works.)


Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>