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 TypeMethodDescriptionreactor.core.publisher.Mono<Boolean>
Removes the given key.reactor.core.publisher.Mono<V>
Get element atindex
form list atkey
.reactor.core.publisher.Mono<Long>
Returns the index of the first occurrence of the specified value in the list at atkey
.reactor.core.publisher.Mono<Long>
lastIndexOf
(K key, V value) Returns the index of the last occurrence of the specified value in the list at atkey
.reactor.core.publisher.Mono<V>
Removes and returns first element in list stored atkey
.reactor.core.publisher.Flux<V>
Removescount
elements from the left-side of the Redis list stored at key.reactor.core.publisher.Mono<V>
Removes and returns first element from lists stored atkey
.reactor.core.publisher.Mono<Long>
Prependvalue
tokey
.reactor.core.publisher.Mono<Long>
Insertvalue
tokey
beforepivot
.reactor.core.publisher.Mono<Long>
leftPushAll
(K key, Collection<V> values) Prependvalues
tokey
.reactor.core.publisher.Mono<Long>
leftPushAll
(K key, V... values) Prependvalues
tokey
.reactor.core.publisher.Mono<Long>
leftPushIfPresent
(K key, V value) Prependvalues
tokey
only if the list exists.reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.default reactor.core.publisher.Mono<V>
move
(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.default reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.reactor.core.publisher.Flux<V>
Get elements betweenbegin
andend
from list atkey
.reactor.core.publisher.Mono<Long>
Removes the firstcount
occurrences ofvalue
from the list stored atkey
.reactor.core.publisher.Mono<V>
Removes and returns last element in list stored atkey
.reactor.core.publisher.Flux<V>
Removescount
elements from the right-side of the Redis list stored at key.reactor.core.publisher.Mono<V>
Removes and returns last element from lists stored atkey
.reactor.core.publisher.Mono<V>
rightPopAndLeftPush
(K sourceKey, K destinationKey) Remove the last element from list atsourceKey
, append it todestinationKey
and return its value.reactor.core.publisher.Mono<V>
rightPopAndLeftPush
(K sourceKey, K destinationKey, Duration timeout) Remove the last element from list atsrcKey
, append it todstKey
and return its value.
Results return once an element available ortimeout
reached.reactor.core.publisher.Mono<Long>
Appendvalue
tokey
.reactor.core.publisher.Mono<Long>
Insertvalue
tokey
afterpivot
.reactor.core.publisher.Mono<Long>
rightPushAll
(K key, Collection<V> values) Appendvalues
tokey
.reactor.core.publisher.Mono<Long>
rightPushAll
(K key, V... values) Appendvalues
tokey
.reactor.core.publisher.Mono<Long>
rightPushIfPresent
(K key, V value) Appendvalues
tokey
only if the list exists.reactor.core.publisher.Mono<Boolean>
Set thevalue
list element atindex
.reactor.core.publisher.Mono<Long>
Get the size of list stored atkey
.reactor.core.publisher.Mono<Boolean>
Trim list atkey
to elements betweenstart
andend
.
-
Method Details
-
range
Get elements betweenbegin
andend
from list atkey
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
trim
Trim list atkey
to elements betweenstart
andend
.- Parameters:
key
- must not be null.start
-end
-- See Also:
-
size
Get the size of list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
leftPush
Prependvalue
tokey
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
leftPushAll
Prependvalues
tokey
.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
leftPushAll
Prependvalues
tokey
.- Parameters:
key
- must not be null.values
- must not be null.- Returns:
- Since:
- 1.5
- See Also:
-
leftPushIfPresent
Prependvalues
tokey
only if the list exists.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
leftPush
Insertvalue
tokey
beforepivot
.- Parameters:
key
- must not be null.pivot
- must not be null.value
-- Returns:
- See Also:
-
rightPush
Appendvalue
tokey
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
rightPushAll
Appendvalues
tokey
.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
rightPushAll
Appendvalues
tokey
.- Parameters:
key
- must not be null.values
-- Returns:
- Since:
- 1.5
- See Also:
-
rightPushIfPresent
Appendvalues
tokey
only if the list exists.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
rightPush
Insertvalue
tokey
afterpivot
.- Parameters:
key
- must not be null.pivot
- must not be null.value
-- Returns:
- See Also:
-
move
default reactor.core.publisher.Mono<V> move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.- Parameters:
from
- must not be null.to
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
move
reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) 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 reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.Blocks connection until element available or
timeout
reached.- Parameters:
from
- must not be null.to
- must not be null.timeout
-- Returns:
- Since:
- 2.6
- See Also:
-
move
reactor.core.publisher.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 thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.Blocks connection until element available or
timeout
reached.- 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
Set thevalue
list element atindex
.- Parameters:
key
- must not be null.index
-value
-- See Also:
-
remove
Removes the firstcount
occurrences ofvalue
from the list stored atkey
.- Parameters:
key
- must not be null.count
-value
-- Returns:
- See Also:
-
index
Get element atindex
form list atkey
.- Parameters:
key
- must not be null.index
-- Returns:
- See Also:
-
indexOf
Returns the index of the first occurrence of the specified value in the list at atkey
.
Requires Redis 6.0.6 or newer.- Parameters:
key
- must not be null.value
- must not be null.- Returns:
- Since:
- 2.4
- See Also:
-
lastIndexOf
Returns the index of the last occurrence of the specified value in the list at atkey
.
Requires Redis 6.0.6 or newer.- Parameters:
key
- must not be null.value
- must not be null.- Returns:
- Since:
- 2.4
- See Also:
-
leftPop
Removes and returns first element in list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
leftPop
Removescount
elements from the left-side of the Redis list stored at key.- Parameters:
key
- must not be null.count
-count
of the number of elements to remove from the left-side of the Redis list.- Returns:
- a
Flux
containing the elements removed from the Redis list. - Since:
- 3.2
- See Also:
-
leftPop
Removes and returns first element from lists stored atkey
.
Results return once an element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
- maximal duration to wait until an entry in the list atkey
is available. Must be eitherDuration.ZERO
or greater {@link 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.- Returns:
- See Also:
-
rightPop
Removes and returns last element in list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
rightPop
Removescount
elements from the right-side of the Redis list stored at key.- Parameters:
key
- must not be null.count
-count
of the number of elements to remove from the right-side of the Redis list.- Returns:
- a
Flux
containing the elements removed from the Redis list. - Since:
- 3.2
- See Also:
-
rightPop
Removes and returns last element from lists stored atkey
.
Results return once an element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
- maximal duration to wait until an entry in the list atkey
is available. Must be eitherDuration.ZERO
or greater {@link 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.- Returns:
- See Also:
-
rightPopAndLeftPush
Remove the last element from list atsourceKey
, append it todestinationKey
and return its value.- Parameters:
sourceKey
- must not be null.destinationKey
- must not be null.- Returns:
- See Also:
-
rightPopAndLeftPush
Remove the last element from list atsrcKey
, append it todstKey
and return its value.
Results return once an element available ortimeout
reached.- Parameters:
sourceKey
- must not be null.destinationKey
- must not be null.timeout
- maximal duration to wait until an entry in the list atsourceKey
is available. Must be eitherDuration.ZERO
or greater {@link 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.- Returns:
- See Also:
-
delete
Removes the given key.- Parameters:
key
- must not be null.
-