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 atindexfrom 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 VRemoves and returns first element from lists stored at the bound key .Prependvalueto the bound key.Prependvaluesto the bound key beforevalue.leftPushAll(V... values) Prependvaluesto the bound key.leftPushIfPresent(V value) Prependvaluesto 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 thefromargument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thetoargument) 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 thefromargument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thetoargument) 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 thefromargument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.range(long start, long end) Get elements betweenbeginandendfrom list at the bound key.Removes the firstcountoccurrences ofvaluefrom 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 VRemoves and returns last element from lists stored at the bound key.Appendvalueto the bound key.Appendvaluesto the bound key beforevalue.rightPushAll(V... values) Appendvaluesto the bound key.rightPushIfPresent(V value) Appendvaluesto the bound key only if the list exists.voidSet thevaluelist element atindex.size()Get the size of list stored at the bound key.voidtrim(long start, long end) Trim list at the bound key to elements betweenstartandend.
-
Method Details
-
range
Get elements betweenbeginandendfrom 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 betweenstartandend.- 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
Prependvalueto the bound key.- Parameters:
value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPushAll
Prependvaluesto the bound key.- Parameters:
values-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPushIfPresent
Prependvaluesto the bound key only if the list exists.- Parameters:
value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPush
Prependvaluesto the bound key beforevalue.- Parameters:
value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPush
Appendvalueto the bound key.- Parameters:
value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPushAll
Appendvaluesto the bound key.- Parameters:
values-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPushIfPresent
Appendvaluesto the bound key only if the list exists.- Parameters:
value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPush
Appendvaluesto 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 thefromargument) of the list stored at the bound key, 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.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 thefromargument) of the list stored at the bound key, 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.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 thefromargument) of the list stored at the bound key, 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.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 thevaluelist element atindex.- Parameters:
index-value-- See Also:
-
remove
Removes the firstcountoccurrences ofvaluefrom the list stored at the bound key.- Parameters:
count-value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
index
Get element atindexfrom 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 ortimeoutreached.- 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 ortimeoutreached.- 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 ortimeoutreached.- 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 ortimeoutreached.- 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()
-