Package io.quarkus.redis.datasource.list
Interface ListCommands<K,V>
- Type Parameters:
K
- the type of the keyV
- the type of the value stored in the lists
- All Superinterfaces:
RedisCommands
- All Known Implementing Classes:
BlockingListCommandsImpl
Allows executing commands from the
list
group.
See the list command list for further information about these commands.
A list
is a bag of members of type V
. Unlike set
, you can have duplicated, and unlike
sorted set
, the members are not sorted.
-
Method Summary
Modifier and TypeMethodDescriptionblmove
(K source, K destination, Position positionInSource, Position positionInDest, Duration timeout) Execute the command BLMOVE.Execute the command BLMPOP.Execute the command BLMPOP.Execute the command BLPOP.Execute the command BRPOP.brpoplpush
(Duration timeout, K source, K destination) Deprecated.See https://redis.io/commands/brpoplpushExecute the command LINDEX.long
linsertAfterPivot
(K key, V pivot, V element) Execute the command LINSERT.long
linsertBeforePivot
(K key, V pivot, V element) Execute the command LINSERT.long
Execute the command LLEN.Execute the command LMOVE.Execute the command LMPOP.Execute the command LMPOP.Execute the command LPOP.Execute the command LPOP.Execute the command LPOS.Execute the command LPOS.Execute the command LPOS.Execute the command LPOS.long
Execute the command LPUSH.long
Execute the command LPUSHX.Execute the command LRANGE.long
Execute the command LREM.void
Execute the command LSET.void
Execute the command LTRIM.Execute the command RPOP.Execute the command RPOP.Deprecated.See https://redis.io/commands/rpoplpushlong
Execute the command RPUSH.long
Execute the command RPUSHX.Execute the command SORT.Execute the command SORT.long
sortAndStore
(K key, K destination) Execute the command SORT with theSTORE
option.long
sortAndStore
(K key, K destination, SortArgs sortArguments) Execute the command SORT with theSTORE
option.Methods inherited from interface io.quarkus.redis.datasource.RedisCommands
getDataSource
-
Method Details
-
blmove
V blmove(K source, K destination, Position positionInSource, Position positionInDest, Duration timeout) Execute the command BLMOVE. Summary: Pop an element from a list, push it to another list and return it; or block until one is available Group: list Requires Redis 6.2.0- Parameters:
source
- the keydestination
- the keypositionInSource
- the position of the element in the source,LEFT
means the first element,RIGHT
means the last element.positionInDest
- the position of the element in the destination,LEFT
means the first element,RIGHT
means the last element.timeout
- the operation timeout (in seconds)- Returns:
- the element being popped from source and pushed to destination. If timeout is reached, a Null reply is returned.
-
blmpop
Execute the command BLMPOP. Summary: Pop elements from a list, or block until one is available Group: list Requires Redis 7.0.0- Parameters:
timeout
- the operation timeout (in seconds)position
- whether if the element must be popped from the beginning of the list (LEFT
) or from the end (RIGHT
)keys
- the keys from which the element must be popped- Returns:
null
when no element could be popped, and timeout is reached, otherwise the key/value structure
-
blmpop
Execute the command BLMPOP. Summary: Pop elements from a list, or block until one is available Group: list Requires Redis 7.0.0- Parameters:
timeout
- the operation timeout (in seconds)position
- whether if the element must be popped from the beginning of the list (LEFT
) or from the end (RIGHT
)count
- the number of element to popkeys
- the keys from which the element must be popped- Returns:
null
when no element could be popped, and timeout is reached, otherwise the list of key/value structures
-
blpop
Execute the command BLPOP. Summary: Remove and get the first element in a list, or block until one is available Group: list Requires Redis 2.0.0- Parameters:
timeout
- the operation timeout (in seconds)keys
- the keys from which the element must be popped- Returns:
- A
null
multi-bulk when no element could be popped and the timeout expired, otherwise the key/value structure.
-
brpop
Execute the command BRPOP. Summary: Remove and get the last element in a list, or block until one is available Group: list Requires Redis 2.0.0- Parameters:
timeout
- the operation timeout (in seconds)keys
- the keys from which the element must be popped- Returns:
- A
null
multi-bulk when no element could be popped and the timeout expired, otherwise the key/value structure.
-
brpoplpush
Deprecated.See https://redis.io/commands/brpoplpushExecute the command BRPOPLPUSH. Summary: Pop an element from a list, push it to another list and return it; or block until one is available Group: list Requires Redis 2.2.0- Parameters:
timeout
- the timeout, in secondssource
- the source keydestination
- the detination key- Returns:
- the element being popped from source and pushed to destination. If timeout is reached, a Null reply is returned.
-
lindex
Execute the command LINDEX. Summary: Get an element from a list by its index Group: list Requires Redis 1.0.0- Parameters:
key
- the keyindex
- the index- Returns:
- the requested element, or
null
when index is out of range.
-
linsertBeforePivot
Execute the command LINSERT. Summary: Insert an element before another element in a list Group: list Requires Redis 2.2.0- Parameters:
key
- the keypivot
- the pivot, i.e. the position referenceelement
- the element to insert- Returns:
- the length of the list after the insert operation, or -1 when the value
pivot
was not found.
-
linsertAfterPivot
Execute the command LINSERT. Summary: Insert an element after another element in a list Group: list Requires Redis 2.2.0- Parameters:
key
- the keypivot
- the pivot, i.e. the position referenceelement
- the element to insert- Returns:
- the length of the list after the insert operation, or -1 when the value
pivot
was not found.
-
llen
Execute the command LLEN. Summary: Get the length of a list Group: list Requires Redis 1.0.0- Parameters:
key
- the key- Returns:
- the length of the list at key, if the list is empty, 0 is returned.
-
lmove
Execute the command LMOVE. Summary: Pop an element from a list, push it to another list and return it Group: list Requires Redis 6.2.0- Parameters:
source
- the keydestination
- the keypositionInSource
- the position of the element to pop in the source (LEFT: first element, RIGHT: last element)positionInDestination
- the position of the element to insert in the destination (LEFT: first element, RIGHT: last element)- Returns:
- the element being popped and pushed.
-
lmpop
Execute the command LMPOP. Summary: Pop one element from the first non-empty list Group: list Requires Redis 7.0.0- Parameters:
position
- the position of the item to pop (LEFT: beginning ot the list, RIGHT: end of the list)keys
- the keys from which the item will be popped, must not be empty- Returns:
- A
null
when no element could be popped. AKeyValue
with the key and popped value.
-
lmpop
Execute the command LMPOP. Summary: Popcount
elements from the first non-empty list Group: list Requires Redis 7.0.0- Parameters:
position
- the position of the item to pop (LEFT: beginning ot the list, RIGHT: end of the list)count
- the number of items to popkeys
- the keys from which the item will be popped, must not be empty- Returns:
empty
when no element could be popped. A list ofKeyValue
with at most count items.
-
lpop
Execute the command LPOP. Summary: Remove and get the first elements in a list Group: list Requires Redis 1.0.0- Parameters:
key
- the key- Returns:
- the value of the first element, or
null
when key does not exist.
-
lpop
Execute the command LPOP. Summary: Remove and get the first elements in a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keycount
- the number of element to pop- Returns:
- the popped elements (at most
count
), orempty
when key does not exist.
-
lpos
Execute the command LPOS. Summary: Return the index of matching elements on a list Group: list Requires Redis 6.0.6- Parameters:
key
- the keyelement
- the element to find- Returns:
- The command returns the integer representing the matching element, or
empty
if there is no match.
-
lpos
Execute the command LPOS. Summary: Return the index of matching elements on a list Group: list Requires Redis 6.0.6- Parameters:
key
- the keyelement
- the element to findargs
- the extra command parameter- Returns:
- The command returns the integer representing the matching element, or
empty
if there is no match.
-
lpos
Execute the command LPOS. Summary: Return the index of matching elements on a list Group: list Requires Redis 6.0.6- Parameters:
key
- the keyelement
- the element to findcount
- the number of occurrence to find- Returns:
- the list of positions (empty if there are no matches).
-
lpos
Execute the command LPOS. Summary: Return the index of matching elements on a list Group: list Requires Redis 6.0.6- Parameters:
key
- the keyelement
- the element to findcount
- the number of occurrence to find- Returns:
- the list of positions (empty if there are no matches).
-
lpush
Execute the command LPUSH. Summary: Prepend one or multiple elements to a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keyelements
- the elements to add- Returns:
- the length of the list after the push operations.
-
lpushx
Execute the command LPUSHX. Summary: Prepend an element to a list, only if the list exists Group: list Requires Redis 2.2.0- Parameters:
key
- the keyelements
- the elements to add- Returns:
- the length of the list after the push operation.
-
lrange
Execute the command LRANGE. Summary: Get a range of elements from a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keystart
- the starting positionstop
- the last position- Returns:
- list of elements in the specified range.
-
lrem
Execute the command LREM. Summary: Remove elements from a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keycount
- the number of occurence to remove, following the given rules: if count > 0: Remove elements equal to element moving from head to tail. if count < 0: Remove elements equal to element moving from tail to head. if count = 0: Remove all elements equal to element.element
- the element to remove- Returns:
- the number of removed elements.
-
lset
Execute the command LSET. Summary: Set the value of an element in a list by its index Group: list Requires Redis 1.0.0- Parameters:
key
- the keyindex
- the indexelement
- the element to insert
-
ltrim
Execute the command LTRIM. Summary: Trim a list to the specified range Group: list Requires Redis 1.0.0- Parameters:
key
- the keystart
- the starting indexstop
- the last index
-
rpop
Execute the command RPOP. Summary: Remove and get the last elements in a list Group: list Requires Redis 1.0.0- Parameters:
key
- the key- Returns:
- the value of the last element, or
null
when key does not exist.
-
rpop
Execute the command RPOP. Summary: Remove and get the last elements in a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keycount
- the number of element to pop- Returns:
- the list of popped elements, or
null
when key does not exist.
-
rpoplpush
Deprecated.See https://redis.io/commands/rpoplpushExecute the command RPOPLPUSH. Summary: Remove the last element in a list, prepend it to another list and return it Group: list Requires Redis 1.2.0- Parameters:
source
- the keydestination
- the key- Returns:
- the element being popped and pushed, or
null
if the source does not exist
-
rpush
Execute the command RPUSH. Summary: Append one or multiple elements to a list Group: list Requires Redis 1.0.0- Parameters:
key
- the keyvalues
- the values to add to the list- Returns:
- the length of the list after the push operation.
-
rpushx
Execute the command RPUSHX. Summary: Append an element to a list, only if the list exists Group: list Requires Redis 2.2.0- Parameters:
key
- the keyvalues
- the values to add to the list- Returns:
- the length of the list after the push operation.
-
sort
Execute the command SORT. Summary: Sort the elements in a list, set or sorted set Group: generic Requires Redis 1.0.0- Returns:
- the list of sorted elements.
-
sort
Execute the command SORT. Summary: Sort the elements in a list, set or sorted set Group: generic Requires Redis 1.0.0- Parameters:
key
- the keysortArguments
- theSORT
command extra-arguments- Returns:
- the list of sorted elements.
-
sortAndStore
Execute the command SORT with theSTORE
option. Summary: Sort the elements in a list, set or sorted set Group: generic Requires Redis 1.0.0- Parameters:
sortArguments
- the SORT command extra-arguments- Returns:
- the number of sorted elements in the destination list.
-
sortAndStore
Execute the command SORT with theSTORE
option. Summary: Sort the elements in a list, set or sorted set Group: generic Requires Redis 1.0.0- Returns:
- the number of sorted elements in the destination list.
-