- Type Parameters:
K- Key type.V- Value type.
- All Known Subinterfaces:
RedisAdvancedClusterCommands<K,V>,RedisClusterCommands<K,V>,RedisClusterPubSubCommands<K,V>,RedisCommands<K,V>,RedisPubSubCommands<K,V>
public interface RedisListCommands<K,V>
Synchronous executed commands for Lists.
- Since:
- 4.0
- Author:
- Mark Paluch
- Generated class:
- by io.lettuce.apigenerator.CreateSyncApi
-
Method Summary
Modifier and Type Method Description Vblmove(K source, K destination, LMoveArgs args, long timeout)Atomically returns and removes the first/last element (head/tail depending on the wherefrom argument) of the list stored at source, and pushes the element at the first/last element (head/tail depending on the whereto argument) of the list stored at destination.KeyValue<K,V>blpop(long timeout, K... keys)Remove and get the first element in a list, or block until one is available.KeyValue<K,V>brpop(long timeout, K... keys)Remove and get the last element in a list, or block until one is available.Vbrpoplpush(long timeout, K source, K destination)Pop a value from a list, push it to another list and return it; or block until one is available.Vlindex(K key, long index)Get an element from a list by its index.Longlinsert(K key, boolean before, V pivot, V value)Insert an element before or after another element in a list.Longllen(K key)Get the length of a list.Vlmove(K source, K destination, LMoveArgs args)Atomically returns and removes the first/last element (head/tail depending on the wherefrom argument) of the list stored at source, and pushes the element at the first/last element (head/tail depending on the whereto argument) of the list stored at destination.Vlpop(K key)Remove and get the first element in a list.List<V>lpop(K key, long count)Remove and get the firstcountelements in a list.Longlpos(K key, V value)Return the index of matching elements inside a Redis list.List<Long>lpos(K key, V value, int count)Return the index of matching elements inside a Redis list using theCOUNToption.List<Long>lpos(K key, V value, int count, LPosArgs args)Return the index of matching elements inside a Redis list using theCOUNToption.Longlpos(K key, V value, LPosArgs args)Return the index of matching elements inside a Redis list.Longlpush(K key, V... values)Prepend one or multiple values to a list.Longlpushx(K key, V... values)Prepend values to a list, only if the list exists.Longlrange(ValueStreamingChannel<V> channel, K key, long start, long stop)Get a range of elements from a list.List<V>lrange(K key, long start, long stop)Get a range of elements from a list.Longlrem(K key, long count, V value)Remove elements from a list.Stringlset(K key, long index, V value)Set the value of an element in a list by its index.Stringltrim(K key, long start, long stop)Trim a list to the specified range.Vrpop(K key)Remove and get the last element in a list.List<V>rpop(K key, long count)Remove and get the lastcountelements in a list.Vrpoplpush(K source, K destination)Remove the last element in a list, append it to another list and return it.Longrpush(K key, V... values)Append one or multiple values to a list.Longrpushx(K key, V... values)Append values to a list, only if the list exists.
-
Method Details
-
blmove
Atomically returns and removes the first/last element (head/tail depending on the wherefrom argument) of the list stored at source, and pushes the element at the first/last element (head/tail depending on the whereto argument) of the list stored at destination. When source is empty, Redis will block the connection until another client pushes to it or until timeout is reached.- Parameters:
source- the source key.destination- the destination type: key.args- command arguments to configure source and destination directions.timeout- the timeout in seconds.- Returns:
- V bulk-string-reply the element being popped and pushed.
- Since:
- 6.1
-
blpop
Remove and get the first element in a list, or block until one is available.- Parameters:
timeout- the timeout in seconds.keys- the keys.- Returns:
- KeyValue<K,V> array-reply specifically:
A
nullmulti-bulk when no element could be popped and the timeout expired. A two-element multi-bulk with the first element being the name of the key where an element was popped and the second element being the value of the popped element.
-
brpop
Remove and get the last element in a list, or block until one is available.- Parameters:
timeout- the timeout in seconds.keys- the keys.- Returns:
- KeyValue<K,V> array-reply specifically:
A
nullmulti-bulk when no element could be popped and the timeout expired. A two-element multi-bulk with the first element being the name of the key where an element was popped and the second element being the value of the popped element.
-
brpoplpush
Pop a value from a list, push it to another list and return it; or block until one is available.- Parameters:
timeout- the timeout in seconds.source- the source key.destination- the destination type: key.- Returns:
- V bulk-string-reply the element being popped from
sourceand pushed todestination. Iftimeoutis reached, a.
-
lindex
Get an element from a list by its index.- Parameters:
key- the key.index- the index type: long.- Returns:
- V bulk-string-reply the requested element, or
nullwhenindexis out of range.
-
linsert
Insert an element before or after another element in a list.- Parameters:
key- the key.before- the before.pivot- the pivot.value- the value.- Returns:
- Long integer-reply the length of the list after the insert operation, or
-1when the valuepivotwas not found.
-
llen
Get the length of a list.- Parameters:
key- the key.- Returns:
- Long integer-reply the length of the list at
key.
-
lmove
Atomically returns and removes the first/last element (head/tail depending on the wherefrom argument) of the list stored at source, and pushes the element at the first/last element (head/tail depending on the whereto argument) of the list stored at destination.- Parameters:
source- the source key.destination- the destination type: key.args- command arguments to configure source and destination directions.- Returns:
- V bulk-string-reply the element being popped and pushed.
- Since:
- 6.1
-
lpop
Remove and get the first element in a list.- Parameters:
key- the key.- Returns:
- V bulk-string-reply the value of the first element, or
nullwhenkeydoes not exist.
-
lpop
Remove and get the firstcountelements in a list.- Parameters:
key- the key.count- the number of elements to return.- Returns:
- Since:
- 6.1
-
lpos
Return the index of matching elements inside a Redis list. By default, when no options are given, it will scan the list from head to tail, looking for the first match of "element". If the element is found, its index (the zero-based position in the list) is returned. Otherwise, if no match is found,nullis returned. The returned elements indexes are always referring to whatlindex(java.lang.Object, long)would return. So first element from head is0, and so forth.- Parameters:
key- the key.value- the element to search for.- Returns:
- V integer-reply representing the matching element, or null if there is no match.
- Since:
- 5.3.2
-
lpos
Return the index of matching elements inside a Redis list. By default, when no options are given, it will scan the list from head to tail, looking for the first match of "element". If the element is found, its index (the zero-based position in the list) is returned. Otherwise, if no match is found,nullis returned. The returned elements indexes are always referring to whatlindex(java.lang.Object, long)would return. So first element from head is0, and so forth.- Parameters:
key- the key.value- the element to search for.args- command arguments to configureFIRSTandMAXLENoptions.- Returns:
- V integer-reply representing the matching element, or null if there is no match.
- Since:
- 5.3.2
-
lpos
Return the index of matching elements inside a Redis list using theCOUNToption. By default, when no options are given, it will scan the list from head to tail, looking for the first match of "element". The returned elements indexes are always referring to whatlindex(java.lang.Object, long)would return. So first element from head is0, and so forth.- Parameters:
key- the key.value- the element to search for.count- limit the number of matches.- Returns:
- V integer-reply representing the matching elements, or empty if there is no match.
- Since:
- 5.3.2
-
lpos
Return the index of matching elements inside a Redis list using theCOUNToption. By default, when no options are given, it will scan the list from head to tail, looking for the first match of "element". The returned elements indexes are always referring to whatlindex(java.lang.Object, long)would return. So first element from head is0, and so forth.- Parameters:
key- the key.value- the element to search for.count- limit the number of matches.args- command arguments to configureFIRSTandMAXLENoptions.- Returns:
- V integer-reply representing the matching elements, or empty if there is no match.
- Since:
- 5.3.2
-
lpush
Prepend one or multiple values to a list.- Parameters:
key- the key.values- the value.- Returns:
- Long integer-reply the length of the list after the push operations.
-
lpushx
Prepend values to a list, only if the list exists.- Parameters:
key- the key.values- the values.- Returns:
- Long integer-reply the length of the list after the push operation.
-
lrange
Get a range of elements from a list.- Parameters:
key- the key.start- the start type: long.stop- the stop type: long.- Returns:
- List<V> array-reply list of elements in the specified range.
-
lrange
Get a range of elements from a list.- Parameters:
channel- the channel.key- the key.start- the start type: long.stop- the stop type: long.- Returns:
- Long count of elements in the specified range.
-
lrem
Remove elements from a list.- Parameters:
key- the key.count- the count type: long.value- the value.- Returns:
- Long integer-reply the number of removed elements.
-
lset
Set the value of an element in a list by its index.- Parameters:
key- the key.index- the index type: long.value- the value.- Returns:
- String simple-string-reply.
-
ltrim
Trim a list to the specified range.- Parameters:
key- the key.start- the start type: long.stop- the stop type: long.- Returns:
- String simple-string-reply.
-
rpop
Remove and get the last element in a list.- Parameters:
key- the key.- Returns:
- V bulk-string-reply the value of the last element, or
nullwhenkeydoes not exist.
-
rpop
Remove and get the lastcountelements in a list.- Parameters:
key- the key.count- the number of elements to return.- Returns:
- List<V> array-reply list of the last
countelements, ornullwhenkeydoes not exist. - Since:
- 6.1
-
rpoplpush
Remove the last element in a list, append it to another list and return it.- Parameters:
source- the source key.destination- the destination type: key.- Returns:
- V bulk-string-reply the element being popped and pushed.
-
rpush
Append one or multiple values to a list.- Parameters:
key- the key.values- the value.- Returns:
- Long integer-reply the length of the list after the push operation.
-
rpushx
Append values to a list, only if the list exists.- Parameters:
key- the key.values- the values.- Returns:
- Long integer-reply the length of the list after the push operation.
-