Interface ReactiveListOperations<K,V>
public interface ReactiveListOperations<K,V>
Reactive Redis operations for List Commands.
Streams of methods returning Mono<K> or Flux<M> are terminated with
InvalidDataAccessApiUsageException when
RedisElementReader.read(ByteBuffer) returns null for a
particular element as Reactive Streams prohibit the usage of null values.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl, John Blum
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionRemoves the given key.Returns the first element from the list atkey.Returns the last element from the list atkey.Get element atindexfrom list atkey.Returns the index of the first occurrence of the specified value in the list at atkey.lastIndexOf(K key, V value) Returns the index of the last occurrence of the specified value in the list at atkey.Removes and returns first element in list stored atkey.Removescountelements from the left-side of the Redis list stored at key.Removes and returns first element from lists stored atkey.Prependvaluetokey.Insertvaluetokeybeforepivot.leftPushAll(K key, Collection<V> values) Prependvaluestokey.leftPushAll(K key, V... values) Prependvaluestokey.leftPushIfPresent(K key, V value) Prependvaluestokeyonly if the list exists.move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.Get elements betweenbeginandendfrom list atkey.Removes the firstcountoccurrences ofvaluefrom the list stored atkey.Removes and returns last element in list stored atkey.Removescountelements from the right-side of the Redis list stored at key.Removes and returns last element from lists stored atkey.rightPopAndLeftPush(K sourceKey, K destinationKey) Remove the last element from list atsourceKey, append it todestinationKeyand return its value.rightPopAndLeftPush(K sourceKey, K destinationKey, Duration timeout) Remove the last element from list atsrcKey, append it todstKeyand return its value.
Results return once an element available ortimeoutreached.Appendvaluetokey.Insertvaluetokeyafterpivot.rightPushAll(K key, Collection<V> values) Appendvaluestokey.rightPushAll(K key, V... values) Appendvaluestokey.rightPushIfPresent(K key, V value) Appendvaluestokeyonly if the list exists.Set thevaluelist element atindex.Get the size of list stored atkey.Trim list atkeyto elements betweenstartandend.
-
Method Details
-
range
-
trim
-
size
-
leftPush
-
leftPushAll
-
leftPushAll
Prependvaluestokey.- Parameters:
key- must not be null.values- must not be null.- Returns:
- Since:
- 1.5
- See Also:
-
leftPushIfPresent
-
leftPush
-
rightPush
-
rightPushAll
-
rightPushAll
Appendvaluestokey.- Parameters:
key- must not be null.values-- Returns:
- Since:
- 1.5
- See Also:
-
rightPushIfPresent
-
rightPush
-
move
Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.- Parameters:
from- must not be null.to- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
move
Mono<V> move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.- Parameters:
sourceKey- must not be null.from- must not be null.destinationKey- must not be null.to- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
move
default Mono<V> move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.Blocks connection until element available or
timeoutreached.- Parameters:
from- must not be null.to- must not be null.timeout-- Returns:
- Since:
- 2.6
- See Also:
-
move
Mono<V> move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.Blocks connection until element available or
timeoutreached.- Parameters:
sourceKey- must not be null.from- must not be null.destinationKey- must not be null.to- must not be null.timeout-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
set
-
remove
-
getFirst
-
getLast
-
index
-
indexOf
-
lastIndexOf
-
leftPop
-
leftPop
Removescountelements from the left-side of the Redis list stored at key. -
leftPop
Removes and returns first element from lists stored atkey.
Results return once an element available ortimeoutreached.- Parameters:
key- must not be null.timeout- maximal duration to wait until an entry in the list atkeyis available. Must be eitherDuration.ZEROor greater 1 second, must not be null. A timeout of zero can be used to wait indefinitely. Durations between zero and one second are not supported. Durations are expected to be in whole seconds so only the seconds field is used - the other fields (e.g. nanos) are ignored.- Returns:
- Throws:
IllegalArgumentException- iftimeoutis between 0 and 1 sec- See Also:
-
rightPop
-
rightPop
Removescountelements from the right-side of the Redis list stored at key. -
rightPop
Removes and returns last element from lists stored atkey.
Results return once an element available ortimeoutreached.- Parameters:
key- must not be null.timeout- maximal duration to wait until an entry in the list atkeyis available. Must be eitherDuration.ZEROor greater 1 second, must not be null. A timeout of zero can be used to wait indefinitely. Durations between zero and one second are not supported. Durations are expected to be in whole seconds so only the seconds field is used - the other fields (e.g. nanos) are ignored.- Returns:
- Throws:
IllegalArgumentException- iftimeoutis between 0 and 1 sec- See Also:
-
rightPopAndLeftPush
-
rightPopAndLeftPush
Remove the last element from list atsrcKey, append it todstKeyand return its value.
Results return once an element available ortimeoutreached.- Parameters:
sourceKey- must not be null.destinationKey- must not be null.timeout- maximal duration to wait until an entry in the list atsourceKeyis available. Must be eitherDuration.ZEROor greater 1 second, must not be null. A timeout of zero can be used to wait indefinitely. Durations between zero and one second are not supported. Durations are expected to be in whole seconds so only the seconds field is used - the other fields (e.g. nanos) are ignored.- Returns:
- Throws:
IllegalArgumentException- iftimeoutis between 0 and 1 sec- See Also:
-
delete
-