Interface BoundListOperations<K,V>
- All Superinterfaces:
BoundKeyOperations<K>
List operations bound to a certain key.
- Author:
- Costin Leau, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionindex
(long index) Get element atindex
form list at the bound key.Returns the index of the first occurrence of the specified value in the list at atkey
.lastIndexOf
(V value) Returns the index of the last occurrence of the specified value in the list at atkey
.leftPop()
Removes and returns first element in list stored at the bound key.leftPop
(long count) Removes and returns first elements in list stored atkey
.Removes and returns first element from lists stored at the bound key .default V
Removes and returns first element from lists stored at the bound key .Prependvalue
to the bound key.Prependvalues
to the bound key beforevalue
.leftPushAll
(V... values) Prependvalues
to the bound key.leftPushIfPresent
(V value) Prependvalues
to the bound key only if the list exists.move
(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.move
(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, long timeout, TimeUnit unit) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.move
(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.range
(long start, long end) Get elements betweenbegin
andend
from list at the bound key.Removes the firstcount
occurrences ofvalue
from the list stored at the bound key.rightPop()
Removes and returns last element in list stored at the bound key.rightPop
(long count) Removes and returns last elements in list stored atkey
.Removes and returns last element from lists stored at the bound key.default V
Removes and returns last element from lists stored at the bound key.Appendvalue
to the bound key.Appendvalues
to the bound key beforevalue
.rightPushAll
(V... values) Appendvalues
to the bound key.rightPushIfPresent
(V value) Appendvalues
to the bound key only if the list exists.void
Set thevalue
list element atindex
.size()
Get the size of list stored at the bound key.void
trim
(long start, long end) Trim list at the bound key to elements betweenstart
andend
.
-
Method Details
-
range
Get elements betweenbegin
andend
from list at the bound key.- Parameters:
start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
trim
void trim(long start, long end) Trim list at the bound key to elements betweenstart
andend
.- Parameters:
start
-end
-- See Also:
-
size
Get the size of list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPush
Prependvalue
to the bound key.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPushAll
Prependvalues
to the bound key.- Parameters:
values
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPushIfPresent
Prependvalues
to the bound key only if the list exists.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPush
Prependvalues
to the bound key beforevalue
.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPush
Appendvalue
to the bound key.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPushAll
Appendvalues
to the bound key.- Parameters:
values
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPushIfPresent
Appendvalues
to the bound key only if the list exists.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPush
Appendvalues
to the bound key beforevalue
.- Parameters:
value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
move
@Nullable V move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, 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.destinationKey
- must not be null.to
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
move
@Nullable V move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, Duration timeout) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, 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.destinationKey
- must not be null.to
- must not be null.timeout
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
move
@Nullable V move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, long timeout, TimeUnit unit) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored at the bound key, 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.destinationKey
- must not be null.to
- must not be null.timeout
-unit
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
set
Set thevalue
list element atindex
.- Parameters:
index
-value
-- See Also:
-
remove
Removes the firstcount
occurrences ofvalue
from the list stored at the bound key.- Parameters:
count
-value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
index
Get element atindex
form list at the bound key.- Parameters:
index
-- Returns:
- null when used in pipeline / transaction.
- 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:
value
- must not be null.- Returns:
- null when used in pipeline / transaction or when not contained in list.
- 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:
value
- must not be null.- Returns:
- null when used in pipeline / transaction or when not contained in list.
- Since:
- 2.4
- See Also:
-
leftPop
Removes and returns first element in list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPop
Removes and returns first elements in list stored atkey
.- Parameters:
count
-- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
leftPop
Removes and returns first element from lists stored at the bound key .
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
-unit
- must not be null.- Returns:
- null when timeout reached or used in pipeline / transaction.
- See Also:
-
leftPop
Removes and returns first element from lists stored at the bound key .
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
- must not be null.- Returns:
- null when timeout reached or used in pipeline / transaction.
- Throws:
IllegalArgumentException
- if the timeout is null or negative.- Since:
- 2.3
- See Also:
-
rightPop
Removes and returns last element in list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPop
Removes and returns last elements in list stored atkey
.- Parameters:
count
-- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
rightPop
Removes and returns last element from lists stored at the bound key.
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
-unit
- must not be null.- Returns:
- null when timeout reached or used in pipeline / transaction.
- See Also:
-
rightPop
Removes and returns last element from lists stored at the bound key.
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
- must not be null.- Returns:
- null when timeout reached or used in pipeline / transaction.
- Throws:
IllegalArgumentException
- if the timeout is null or negative.- Since:
- 2.3
- See Also:
-
getOperations
RedisOperations<K,V> getOperations()
-