Interface BoundListOperations<K,V>
- All Superinterfaces:
BoundKeyOperations<K>
List operations bound to a certain key.
- Author:
- Costin Leau, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptiongetFirst()Returns the first element from the list at the boundkey.getLast()Returns the last element from the list at the boundkey.@NonNull RedisOperations<K, V> index(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 .Prependvaluesto the bound key beforevalue.Prependvalueto the bound key.leftPushAll(V... values) Prependvaluesto the bound key.leftPushIfPresent(V value) Prependvaluesto the bound key only if the list exists.move(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull 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(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull RedisListCommands.Direction to, long timeout, @NonNull 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(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull RedisListCommands.Direction to, @NonNull 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.Appendvaluesto the bound key beforevalue.Appendvalueto the bound key.rightPushAll(V @NonNull ... 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
-
trim
void trim(long start, long end) Trim list at the bound key to elements betweenstartandend.- Parameters:
start-end-- See Also:
-
size
Long size()Get the size of list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPush
-
leftPushAll
-
leftPushIfPresent
-
leftPush
-
rightPush
-
rightPushAll
-
rightPushIfPresent
-
rightPush
-
move
V move(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull 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
V move(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull RedisListCommands.Direction to, @NonNull 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
V move(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull RedisListCommands.Direction to, long timeout, @NonNull 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
-
getFirst
V getFirst()Returns the first element from the list at the boundkey.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.4
-
getLast
V getLast()Returns the last element from the list at the boundkey.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.4
-
index
Get element atindexfrom list at the bound key.- Parameters:
index-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
indexOf
-
lastIndexOf
-
leftPop
V leftPop()Removes and returns first element in list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
leftPop
-
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
V rightPop()Removes and returns last element in list stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rightPop
-
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
@NonNull RedisOperations<K,V> getOperations()- Specified by:
getOperationsin interfaceBoundKeyOperations<K>- Returns:
- the underlying
RedisOperationsused to execute commands.
-