DATAREDIS-333 - Use binary version of Jedis.evalsha()
* JedisConnection.eval() uses binary version of Jedis.eval() * but JedisConnection.evalsha() uses string version of Jedis.evalsha() * this commit changes JedisConnection.evalsha() to use binary version of Jedis.evalsha() --- Original Pull Request: #91 CLA: 88220140729064528 (Jungtaek Lim)
This commit is contained in:
committed by
Christoph Strobl
parent
b7d8eacdcf
commit
c36a58da7f
@@ -32,8 +32,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.ExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
||||
import org.springframework.data.redis.FallbackExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
||||
import org.springframework.data.redis.connection.DataType;
|
||||
import org.springframework.data.redis.connection.FutureResult;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
@@ -83,6 +83,7 @@ import redis.clients.util.Pool;
|
||||
* @author Jennifer Hickey
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author Jungtaek Lim
|
||||
*/
|
||||
public class JedisConnection implements RedisConnection {
|
||||
|
||||
@@ -2803,8 +2804,8 @@ public class JedisConnection implements RedisConnection {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
try {
|
||||
return (T) new JedisScriptReturnConverter(returnType).convert(jedis.evalsha(scriptSha1, numKeys,
|
||||
JedisConverters.toStrings(keysAndArgs)));
|
||||
return (T) new JedisScriptReturnConverter(returnType).convert(jedis.evalsha(JedisConverters.toBytes(scriptSha1),
|
||||
numKeys, keysAndArgs));
|
||||
} catch (Exception ex) {
|
||||
throw convertJedisAccessException(ex);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import redis.clients.util.SafeEncoder;
|
||||
* @author Jennifer Hickey
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author Jungtaek Lim
|
||||
*/
|
||||
abstract public class JedisConverters extends Converters {
|
||||
|
||||
@@ -135,6 +136,10 @@ abstract public class JedisConverters extends Converters {
|
||||
return String.valueOf(source).getBytes();
|
||||
}
|
||||
|
||||
public static byte[] toBytes(String source) {
|
||||
return STRING_TO_BYTES.convert(source);
|
||||
}
|
||||
|
||||
public static String toString(byte[] source) {
|
||||
return source == null ? null : SafeEncoder.encode(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user