admin管理员组文章数量:1389758
Redis func is registered having the body
redis.register_function('eval_resources', function(keys, args)
return type(args[1]) .. " " .. args[1]
end)
Caller's code
Object[] argsList = {"123", "abc"};
String res2 = function.call(
FunctionMode.WRITE,
"eval_resources",
FunctionResult.STRING,
Collections.emptyList(),
argsList);
Response I am getting
string 12�
Due to this encoding issue, I am not able to parse integer as an input inside Lua script.
I tried removing the end character, still the input cannot be parsed to integer.
redis.register_function('eval_resources', function(keys, args)
local actual_val = tostring(string.sub(args[1], 1, 2))
local numericalVal = tonumber(actual_val)
return type(actual_val) .. " " .. actual_val .. " type of num ->" .. type(numericalVal)
end)
This is working perfectly with redis-cli.
Redis func is registered having the body
redis.register_function('eval_resources', function(keys, args)
return type(args[1]) .. " " .. args[1]
end)
Caller's code
Object[] argsList = {"123", "abc"};
String res2 = function.call(
FunctionMode.WRITE,
"eval_resources",
FunctionResult.STRING,
Collections.emptyList(),
argsList);
Response I am getting
string 12�
Due to this encoding issue, I am not able to parse integer as an input inside Lua script.
I tried removing the end character, still the input cannot be parsed to integer.
redis.register_function('eval_resources', function(keys, args)
local actual_val = tostring(string.sub(args[1], 1, 2))
local numericalVal = tonumber(actual_val)
return type(actual_val) .. " " .. actual_val .. " type of num ->" .. type(numericalVal)
end)
This is working perfectly with redis-cli.
Share Improve this question asked Mar 12 at 20:58 siddharthabhi30siddharthabhi30 608 bronze badges 1- lua script worked perfectly too. – siddharthabhi30 Commented Mar 12 at 21:05
1 Answer
Reset to default 0Found the root cause.
Redisson was adding extra characters while encoding https://redisson.pro/docs/data-and-services/data-serialization/?utm_source=chatgpt
Plain text codec works
config.setCodec(new StringCodec());
config.useSingleServer()
.setAddress(redisURL)
.setConnectionPoolSize(30);
RedissonClient redisson = Redisson.create(config);
本文标签: luaRedisson with Redis function is adding a special character while sending the inputStack Overflow
版权声明:本文标题:lua - Redisson with Redis function is adding a special character while sending the input - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744730764a2622034.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论