EsRedisListCommands
Description
Provides an API for the Redis List commands. Redis lists are implemented via linked lists. This means that even if you have millions of elements inside a list, the operation of adding a new element in the head or in the tail of the list is performed in constant time.
This command group is accessed via EsRedisClient>>lists.
Class Methods
None
Instance Methods
blmove:destination:from:to:timeout:
Blocking version of LMOVE.
Arguments:
aSource - <String> The source list key.
aDestination - <String> The destination list key.
aFrom - <String> 'LEFT' or 'RIGHT'.
aTo - <String> 'LEFT' or 'RIGHT'.
aTimeout - <Integer> Timeout in seconds.
Answers:
<String | ByteArray> The element being moved, or nil if a timeout occurred.
<EsFuture> In async mode, a future that completes with the result.
blmpop:numkeys:keys:from:count:
Blocking version of LMPOP. Waits up to `aTimeout` seconds for one or more elements to become available.
Arguments:
aTimeout - <Integer | Float> Timeout in seconds.
aNumkeys - <Integer> Number of keys to scan.
aKeys - <Collection of String> The keys to examine.
aFrom - <String> Either 'LEFT' or 'RIGHT'.
aCount - <Integer> The number of elements to pop.
Answers:
<Array> An array with the key popped from and the list of elements, or nil if a timeout occurred.
<EsFuture> In async mode, a future that completes with the result.
blpop:timeout:
Remove and get the first element from the first non-empty list among the
specified keys, blocking until one is available or the timeout expires.
Arguments:
keys - <Collection of String> The list keys to check (in order).
timeout - <Integer> Timeout in seconds. 0 means block indefinitely.
Answers:
<Array> Two elements: the key and the popped value, or nil if no element
was popped before timeout.
<EsFuture> In async mode, a future that completes with the result.
brpop:timeout:
Remove and get the last element from the first non-empty list among the
specified keys, blocking until one is available or the timeout expires.
Arguments:
keys - <Collection of String> The list keys to check (in order).
timeout - <Integer> Timeout in seconds. 0 means block indefinitely.
Answers:
<Array> Two elements: the key and the popped value, or nil if no element
was popped before timeout.
<EsFuture> In async mode, a future that completes with the result.
brpoplpush:destination:timeout:
Remove the last element from the source list, add it to the head of the
destination list, and return it, blocking until one is available or the
timeout expires.
Arguments:
source - <String> The source list key.
destination - <String> The destination list key.
timeout - <Integer> Timeout in seconds. 0 means block indefinitely.
Answers:
<String | ByteArray> The element that was moved, or nil if no element
was moved before timeout.
<EsFuture> In async mode, a future that completes with the result.
lindex:index:
Get an element from a list by its index.
Arguments:
aKey - <String> The key of the list.
anInteger - <Integer> The zero-based index of the element to get.
Answers:
<String | ByteArray> The element at the specified index, or nil if the index is out of range.
<EsFuture> In async mode, a future that completes with the result.
linsert:beforeOrAfter:pivot:value:
Insert a value before or after the pivot element in the list.
Arguments:
key - <String> The key of the list.
beforeOrAfter - <String> Either 'BEFORE' or 'AFTER' (case-insensitive).
pivot - <Object> The value to search for as the pivot.
value - <Object> The value to insert.
Answers:
<Integer> The length of the list after insertion, or -1 if the pivot was
not found.
<EsFuture> In async mode, a future that completes with the result.
llen:
Get the length of a list.
Arguments:
aKey - <String> The key of the list.
Answers:
<Integer> The length of the list.
<EsFuture> In async mode, a future that completes with the result.
lmove:destination:from:to:
Atomically returns and removes the first/last element of a list, and pushes it to the first/last element of another list.
Arguments:
aSource - <String> The source list key.
aDestination - <String> The destination list key.
aFrom - <String> 'LEFT' or 'RIGHT'.
aTo - <String> 'LEFT' or 'RIGHT'.
Answers:
<String | ByteArray> The element being moved.
<EsFuture> In async mode, a future that completes with the result.
lmpop:keys:from:count:
Pops one or more elements from the first non-empty list among the provided keys.
Arguments:
aNumkeys - <Integer> The number of keys you’re providing.
aKeys - <Collection of String> The keys to check in order.
aFrom - <String> Either 'LEFT' or 'RIGHT' for pop direction.
aCount - <Integer> Maximum number of elements to pop.
Answers:
<Array> An array where the first element is the key that was popped from,
followed by the popped elements.
<EsFuture> In async mode, a future completing with the result.
lpop:
Remove and get the first element in a list.
Arguments:
aKey - <String> The key of the list.
Answers:
<String | ByteArray> The value of the first element, or nil if the list is empty.
<EsFuture> In async mode, a future that completes with the result.
lpop:count:
Remove and get the first elements of a list.
Arguments:
aKey - <String> The key of the list.
anInteger - <Integer> The number of elements to pop.
Answers:
<Array> The values of the first elements.
<EsFuture> In async mode, a future that completes with the result.
lpos:element:
Return the index of matching elements in a list.
Arguments:
aKey - <String> The key of the list.
anElement - <Object> The element to search for.
Answers:
<Integer> The index of the first matching element.
<EsFuture> In async mode, a future that completes with the result.
lpos:element:options:
Return the index of matching elements in a list, with options.
Arguments:
aKey - <String> The key of the list.
anElement - <Object> The element to search for.
aCollectionOfOptions - <Collection> Optional arguments like RANK, COUNT, MAXLEN.
Answers:
<Integer | Array> The index of the matching element, or an array of indices.
<EsFuture> In async mode, a future that completes with the result.
lpush:values:
Prepend one or multiple values to a list.
Arguments:
aKey - <String> The key of the list.
aValueOrCollection - <Object | SequenceableCollection> The value or values to prepend.
Answers:
<Integer> The length of the list after the push operation.
<EsFuture> In async mode, a future that completes with the result.
lpushx:value:
Insert value at the head of the list only if the list already exists.
Arguments:
key - <String> The key of the list.
value - <Object> The value to insert.
Answers:
<Integer> The length of the list after insertion, or 0 if the list did not
exist.
<EsFuture> In async mode, a future that completes with the result.
lrange:start:stop:
Get a range of elements from a list.
Arguments:
aKey - <String> The key of the list.
startInteger - <Integer> The starting zero-based index.
stopInteger - <Integer> The ending zero-based index.
Answers:
<Array> An array of elements within the specified range.
<EsFuture> In async mode, a future that completes with the result.
lrem:count:value:
Remove elements from a list.
Arguments:
aKey - <String> The key of the list.
anInteger - <Integer> The number of occurrences to remove.
aValue - <Object> The value to remove.
Answers:
<Integer> The number of removed elements.
<EsFuture> In async mode, a future that completes with the result.
lset:index:value:
Set the list element at index to value.
Arguments:
key - <String> The key of the list.
index - <Integer> The zero-based index (can be negative).
value - <Object> The new value to set.
Answers:
<String> 'OK' if successful, or an error if the index is out of range.
<EsFuture> In async mode, a future that completes with the result.
ltrim:start:stop:
Trim a list to a specified range.
Arguments:
aKey - <String> The key of the list.
startInteger - <Integer> The starting zero-based index.
stopInteger - <Integer> The ending zero-based index.
Answers:
<String> 'OK'.
<EsFuture> In async mode, a future that completes with the result.
rpop:
Remove and get the last element in a list.
Arguments:
aKey - <String> The key of the list.
Answers:
<String | ByteArray> The value of the last element, or nil if the list is empty.
<EsFuture> In async mode, a future that completes with the result.
rpop:count:
Remove and get the last elements of a list.
Arguments:
aKey - <String> The key of the list.
anInteger - <Integer> The number of elements to pop.
Answers:
<Array> The values of the last elements.
<EsFuture> In async mode, a future that completes with the result.
rpoplpush:destination:
Remove the last element from the source list and add it to the head of the
destination list.
Arguments:
source - <String> The source list key.
destination - <String> The destination list key.
Answers:
<String | ByteArray> The element moved, or nil if the source is empty.
<EsFuture> In async mode, a future that completes with the result.
rpush:values:
Append one or multiple values to a list.
Arguments:
aKey - <String> The key of the list.
aValueOrCollection - <Object | SequenceableCollection> The value or values to append.
Answers:
<Integer> The length of the list after the push operation.
<EsFuture> In async mode, a future that completes with the result.
rpushx:value:
Insert value at the tail of the list only if the list already exists.
Arguments:
key - <String> The key of the list.
value - <Object> The value to insert.
Answers:
<Integer> The length of the list after insertion, or 0 if the list did not
exist.
<EsFuture> In async mode, a future that completes with the result.
Last modified date: 01/22/2026