DATAREDIS-237 - Upgrade to Jedis 2.2.1.
Update to Jedis 2.2.1 and Implement newly supported Operations. Handle removed BinaryTransaction class. Handle some Jedis return types changed from String to bytes. Handle some Jedis arg types changed from int to long by removing casting. Remove ignored tests for issues fixed in Jedis 2.2.1 Throw UnsupportedOpException on multi-arg bitOp NOT Ensure consistent results across all drivers when bitOp is called with NOT and more than one arg.
This commit is contained in:
committed by
Christoph Strobl
parent
2870df0cdc
commit
e1b421f942
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.DefaultTuple;
|
||||
import org.springframework.data.redis.connection.RedisListCommands.Position;
|
||||
import org.springframework.data.redis.connection.RedisStringCommands.BitOperation;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.redis.connection.SortParameters;
|
||||
import org.springframework.data.redis.connection.SortParameters.Order;
|
||||
@@ -33,6 +34,7 @@ import org.springframework.data.redis.connection.convert.SetConverter;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
import redis.clients.jedis.BitOP;
|
||||
import redis.clients.jedis.SortingParams;
|
||||
import redis.clients.util.SafeEncoder;
|
||||
|
||||
@@ -159,4 +161,19 @@ abstract public class JedisConverters extends Converters {
|
||||
}
|
||||
return jedisParams;
|
||||
}
|
||||
|
||||
public static BitOP toBitOp(BitOperation bitOp) {
|
||||
switch(bitOp) {
|
||||
case AND:
|
||||
return BitOP.AND;
|
||||
case OR:
|
||||
return BitOP.OR;
|
||||
case NOT:
|
||||
return BitOP.NOT;
|
||||
case XOR:
|
||||
return BitOP.XOR;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,6 +1102,9 @@ public class SrpConnection implements RedisConnection {
|
||||
|
||||
|
||||
public Long bitOp(BitOperation op, byte[] destination, byte[]... keys) {
|
||||
if(op == BitOperation.NOT && keys.length > 1) {
|
||||
throw new UnsupportedOperationException("Bitop NOT should only be performed against one key");
|
||||
}
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
pipeline(new SrpResult(pipeline.bitop(SrpConverters.toBytes(op), destination, (Object[]) keys)));
|
||||
|
||||
Reference in New Issue
Block a user