lettuce
lettuce copied to clipboard
Eval lua script expects return integer but null
Bug Report
Current Behavior
There is a string key named a
, which value is 1
in Redis.
I want to read the value as Long
by lua script.
However, it returns null
unexpectedlly.
Input Code
// code example
final RedisCommands<String, String> redisCommands = redisClient.connect().sync();
redisCommands.set("a", "1"); // SET a 1
String luaScript = "return redis.call('GET', KEYS[1])";
Long val = redisCommands.eval(luaScript, ScriptOutputType.INTEGER, "a");
System.out.println(val); // expect output "1" but "null"
Expected behavior/code
return 1
as expected ( OR maybe throw exception ) . Does NOT return null
silently.
Environment
- Lettuce version(s): 6.1.9.RELEASE
- Redis version: 6.0.14
Possible Solution
Enhance type conversion compatibility. Throw an exception when the types are still not compatible.
Additional context
BTW, Redisson client works well in same situation.