readAll and readAllAsync methods added to RList. #374

pull/382/head
Nikita 9 years ago
parent cdcf1bdfa1
commit a921cb009d

@ -94,11 +94,13 @@ public class RedissonList<V> extends RedissonExpirable implements RList<V> {
return list.toArray();
}
private List<V> readAll() {
return (List<V>) get(readAllAsync());
@Override
public List<V> readAll() {
return get(readAllAsync());
}
private Future<Collection<V>> readAllAsync() {
@Override
public Future<List<V>> readAllAsync() {
return commandExecutor.readAsync(getName(), codec, LRANGE, getName(), 0, -1);
}

@ -105,11 +105,13 @@ public class RedissonSubList<V> extends RedissonExpirable implements RList<V> {
return list.toArray();
}
private List<V> readAll() {
return (List<V>) get(readAllAsync());
@Override
public List<V> readAll() {
return get(readAllAsync());
}
private Future<Collection<V>> readAllAsync() {
@Override
public Future<List<V>> readAllAsync() {
return commandExecutor.readAsync(getName(), codec, LRANGE, getName(), fromIndex, toIndex.get()-1);
}

@ -31,4 +31,11 @@ public interface RList<V> extends List<V>, RExpirable, RListAsync<V>, RandomAcce
RList<V> subList(int fromIndex, int toIndex);
/**
* Read all elements at once
*
* @return
*/
List<V> readAll();
}

@ -16,6 +16,7 @@
package org.redisson.core;
import java.util.Collection;
import java.util.List;
import java.util.RandomAccess;
import io.netty.util.concurrent.Future;
@ -41,4 +42,11 @@ public interface RListAsync<V> extends RCollectionAsync<V>, RandomAccess {
Future<V> getAsync(int index);
/**
* Read all elements at once
*
* @return
*/
Future<List<V>> readAllAsync();
}

Loading…
Cancel
Save