我正在尝试使用 Lua 脚本将存储在 Redis 中的两个数字相乘。但我得到了 ClassCastException。有人可以指出程序中有什么问题吗
jedis.set("one", "1");
jedis.set("two", "2");
String script = "return {tonumber(redis.call('get',KEYS[1])) * tonumber(redis.call('get',KEYS[2]))}";
String [] keys = new String[]{"one","two"};
Object response = jedis.eval(script, 2, keys );
System.out.println(response);
投掷
Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to [B
at redis.clients.jedis.Jedis.getEvalResult(Jedis.java:2806)
at redis.clients.jedis.Jedis.eval(Jedis.java:2766)
at com.test.jedis.script.SimpleScript.main(SimpleScript.java:18)