Polishing.
Reorder methods to align with ListOperations. Simplify tests to avoid test noise. See #2692 Original pull request: #2704
This commit is contained in:
@@ -240,6 +240,14 @@ class DefaultReactiveListOperations<K, V> implements ReactiveListOperations<K, V
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<V> leftPop(K key, long count) {
|
||||
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
|
||||
return createFlux(listCommands -> listCommands.lPop(rawKey(key), count).map(this::readValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<V> leftPop(K key, Duration timeout) {
|
||||
|
||||
@@ -252,14 +260,6 @@ class DefaultReactiveListOperations<K, V> implements ReactiveListOperations<K, V
|
||||
.map(popResult -> readValue(popResult.getValue())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<V> leftPop(K key, long count) {
|
||||
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
|
||||
return createFlux(listCommands -> listCommands.lPop(rawKey(key), count).map(this::readValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<V> rightPop(K key) {
|
||||
|
||||
@@ -268,6 +268,14 @@ class DefaultReactiveListOperations<K, V> implements ReactiveListOperations<K, V
|
||||
return createMono(listCommands -> listCommands.rPop(rawKey(key)).map(this::readValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<V> rightPop(K key, long count) {
|
||||
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
|
||||
return createFlux(listCommands -> listCommands.rPop(rawKey(key), count).map(this::readValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<V> rightPop(K key, Duration timeout) {
|
||||
|
||||
@@ -280,14 +288,6 @@ class DefaultReactiveListOperations<K, V> implements ReactiveListOperations<K, V
|
||||
.map(popResult -> readValue(popResult.getValue())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<V> rightPop(K key, long count) {
|
||||
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
|
||||
return createFlux(listCommands -> listCommands.rPop(rawKey(key), count).map(this::readValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<V> rightPopAndLeftPush(K sourceKey, K destinationKey) {
|
||||
|
||||
|
||||
@@ -313,6 +313,17 @@ public interface ReactiveListOperations<K, V> {
|
||||
*/
|
||||
Mono<V> leftPop(K key);
|
||||
|
||||
/**
|
||||
* Removes {@link Long count} elements from the left-side of the Redis list stored at key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count {@link Long count} of the number of elements to remove from the left-side of the Redis list.
|
||||
* @return a {@link Flux} containing the elements removed from the Redis list.
|
||||
* @since 3.2
|
||||
* @see <a href="https://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
*/
|
||||
Flux<V> leftPop(K key, long count);
|
||||
|
||||
/**
|
||||
* Removes and returns first element from lists stored at {@code key}. <br>
|
||||
* <b>Results return once an element available or {@code timeout} reached.</b>
|
||||
@@ -326,16 +337,6 @@ public interface ReactiveListOperations<K, V> {
|
||||
*/
|
||||
Mono<V> leftPop(K key, Duration timeout);
|
||||
|
||||
/**
|
||||
* Removes {@link Long count} elements from the left-side of the Redis list stored at key.
|
||||
*
|
||||
* @param key {@link K Key} referring to the list stored in Redis; must not be {@literal null}.
|
||||
* @param count {@link Long count} of the number of elements to remove from the left-side of the Redis list.
|
||||
* @return a {@link Flux} containing the elements removed from the Redis list.
|
||||
* @since 3.2
|
||||
*/
|
||||
Flux<V> leftPop(K key, long count);
|
||||
|
||||
/**
|
||||
* Removes and returns last element in list stored at {@code key}.
|
||||
*
|
||||
@@ -345,6 +346,17 @@ public interface ReactiveListOperations<K, V> {
|
||||
*/
|
||||
Mono<V> rightPop(K key);
|
||||
|
||||
/**
|
||||
* Removes {@link Long count} elements from the right-side of the Redis list stored at key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count {@link Long count} of the number of elements to remove from the right-side of the Redis list.
|
||||
* @return a {@link Flux} containing the elements removed from the Redis list.
|
||||
* @since 3.2
|
||||
* @see <a href="https://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
Flux<V> rightPop(K key, long count);
|
||||
|
||||
/**
|
||||
* Removes and returns last element from lists stored at {@code key}. <br>
|
||||
* <b>Results return once an element available or {@code timeout} reached.</b>
|
||||
@@ -358,16 +370,6 @@ public interface ReactiveListOperations<K, V> {
|
||||
*/
|
||||
Mono<V> rightPop(K key, Duration timeout);
|
||||
|
||||
/**
|
||||
* Removes {@link Long count} elements from the right-side of the Redis list stored at key.
|
||||
*
|
||||
* @param key {@link K Key} referring to the list stored in Redis; must not be {@literal null}.
|
||||
* @param count {@link Long count} of the number of elements to remove from the right-side of the Redis list.
|
||||
* @return a {@link Flux} containing the elements removed from the Redis list.
|
||||
* @since 3.2
|
||||
*/
|
||||
Flux<V> rightPop(K key, long count);
|
||||
|
||||
/**
|
||||
* Remove the last element from list at {@code sourceKey}, append it to {@code destinationKey} and return its value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user