The spring data redis always require inputs in byte[], so I tried to create a wrapper class so I don't need to convert String to bytes everytime.
However now I encountered an issue with evalSHA method, since it accepts varargs.
evalSha(byte[] scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs)
How to convert my varargs in String to varargs in byte[]?
Below is my current code :
public List<String> evalSHA(String script, int numKeys, String ... keys){
List<String> result = null;
RedisConnection redis = redisConnectionFactory.getConnection();
byte[] scriptSHA = redis.get("SCRIPT:CALGROUPQUEUE".getBytes());
if(scriptSHA==null || scriptSHA.length==0){
logger.error("no such script");
return null;
}
List<byte[]> keysInByte = vargsToList(keys);
// what to do below?
List<byte[]> resultBytes = redis.evalSha (scriptSHA, ReturnType.MULTI, ???);
if(resultBytes!=null && !resultBytes.isEmpty()){
result = new ArrayList<>();
//... to do later
}
}