Fixed - RedissonConnection add lpos command

Signed-off-by: wd <woody_me@qq.com>
pull/4056/head
wd 3 years ago
parent 132e34c757
commit ab0b9f4bf7

@ -785,6 +785,31 @@ public class RedissonConnection extends AbstractRedisConnection {
return write(srcKey, ByteArrayCodec.INSTANCE, RedisCommands.BRPOPLPUSH, srcKey, dstKey, timeout);
}
private static final RedisCommand<List<Long>> LPOS = new RedisCommand<>("LPOS", new ObjectListReplayDecoder<>());
@Override
public List<Long> lPos(byte[] key, byte[] element, Integer rank, Integer count) {
List<Object> args = new ArrayList<>();
args.add(key);
args.add(element);
if (rank != null) {
args.add("RANK");
args.add(rank);
}
if (count != null) {
args.add("COUNT");
args.add(count);
}
Object read = read(key, ByteArrayCodec.INSTANCE, LPOS, args.toArray());
if (read == null) {
return Collections.emptyList();
} else if (read instanceof Long) {
return Collections.singletonList((Long) read);
} else {
return (List<Long>) read;
}
}
private static final RedisCommand<Long> SADD = new RedisCommand<Long>("SADD");
@Override

@ -785,6 +785,31 @@ public class RedissonConnection extends AbstractRedisConnection {
return write(srcKey, ByteArrayCodec.INSTANCE, RedisCommands.BRPOPLPUSH, srcKey, dstKey, timeout);
}
private static final RedisCommand<List<Long>> LPOS = new RedisCommand<>("LPOS", new ObjectListReplayDecoder<>());
@Override
public List<Long> lPos(byte[] key, byte[] element, Integer rank, Integer count) {
List<Object> args = new ArrayList<>();
args.add(key);
args.add(element);
if (rank != null) {
args.add("RANK");
args.add(rank);
}
if (count != null) {
args.add("COUNT");
args.add(count);
}
Object read = read(key, ByteArrayCodec.INSTANCE, LPOS, args.toArray());
if (read == null) {
return Collections.emptyList();
} else if (read instanceof Long) {
return Collections.singletonList((Long) read);
} else {
return (List<Long>) read;
}
}
private static final RedisCommand<Long> SADD = new RedisCommand<Long>("SADD");
@Override

@ -785,6 +785,31 @@ public class RedissonConnection extends AbstractRedisConnection {
return write(srcKey, ByteArrayCodec.INSTANCE, RedisCommands.BRPOPLPUSH, srcKey, dstKey, timeout);
}
private static final RedisCommand<List<Long>> LPOS = new RedisCommand<>("LPOS", new ObjectListReplayDecoder<>());
@Override
public List<Long> lPos(byte[] key, byte[] element, Integer rank, Integer count) {
List<Object> args = new ArrayList<>();
args.add(key);
args.add(element);
if (rank != null) {
args.add("RANK");
args.add(rank);
}
if (count != null) {
args.add("COUNT");
args.add(count);
}
Object read = read(key, ByteArrayCodec.INSTANCE, LPOS, args.toArray());
if (read == null) {
return Collections.emptyList();
} else if (read instanceof Long) {
return Collections.singletonList((Long) read);
} else {
return (List<Long>) read;
}
}
private static final RedisCommand<Long> SADD = new RedisCommand<Long>("SADD");
@Override

Loading…
Cancel
Save