K - Key type.V - Value type.public interface RedisArrayCommands<K,V>
Arrays are a Redis data type for sparse, indexed collections that support efficient element access, range operations, pattern matching, and aggregation.
| Modifier and Type | Method and Description |
|---|---|
Long |
arcount(K key)
Get the count of populated (non-empty) slots in the array.
|
Long |
ardel(K key,
long... indices)
Delete elements at the given indices.
|
Long |
ardel(K key,
long index)
Delete a single element at the given index.
|
Long |
ardelrange(K key,
ArrayIndexRange... ranges)
Delete elements in the given ranges.
|
Long |
ardelrange(K key,
long start,
long end)
Delete elements in the given range (inclusive).
|
V |
arget(K key,
long index)
Get the value at the given index in the array stored at
key. |
List<V> |
argetrange(K key,
long start,
long end)
Get all values in a range, including
null for empty slots. |
List<Long> |
argrep(K key,
ArGrepArgs grepArgs)
Search for elements matching predicates, returning matching indices.
|
List<IndexedValue<V>> |
argrepWithValues(K key,
ArGrepArgs grepArgs)
Search for elements matching predicates, returning index/value pairs.
|
ArrayInfo |
arinfo(K key)
Get metadata about the array.
|
ArrayInfoFull |
arinfoFull(K key)
Get extended metadata about the array (including per-slice stats).
|
Long |
arinsert(K key,
V... values)
Insert one or more values at the next available index.
|
Long |
arinsert(K key,
V value)
Insert a single value at the next available index.
|
List<V> |
arlastitems(K key,
long count)
Get the last N items in insertion order.
|
List<V> |
arlastitems(K key,
long count,
boolean rev)
Get the last N items, optionally in reverse order.
|
Long |
arlen(K key)
Get the logical length of the array (max index + 1).
|
List<V> |
armget(K key,
long... indices)
Get the values at multiple indices in the array stored at
key. |
Long |
armset(K key,
Map<Long,V> indexValueMap)
Set multiple index-value pairs in the array stored at
key. |
Long |
arnext(K key)
Get the next insert index for the array.
|
V |
aropAggregate(K key,
long start,
long end,
ArAggregateType operation)
Perform an aggregate operation (SUM, MIN, MAX) over elements in a range.
|
Long |
aropBitwise(K key,
long start,
long end,
ArBitwiseType operation)
Perform a bitwise operation (AND, OR, XOR) over elements in a range.
|
Long |
aropCount(K key,
long start,
long end)
Count the number of non-empty (populated) elements in a range (AROP USED).
|
Long |
aropCount(K key,
long start,
long end,
V matchValue)
Count occurrences of a value in a range (AROP MATCH).
|
Long |
arring(K key,
long size,
V... values)
Insert values in a ring buffer fashion, wrapping around when the size is exceeded.
|
Long |
arring(K key,
long size,
V value)
Insert a single value in a ring buffer fashion, wrapping around when the size is exceeded.
|
List<IndexedValue<V>> |
arscan(K key,
long start,
long end)
Scan populated entries in a range, returning index/value pairs.
|
List<IndexedValue<V>> |
arscan(K key,
long start,
long end,
long limit)
Scan populated entries in a range with a limit, returning index/value pairs.
|
Long |
arseek(K key,
long index)
Set the insert cursor to a specific index.
|
Long |
arset(K key,
long index,
V... values)
Set one or more contiguous values starting at the given index in the array stored at
key. |
Long |
arset(K key,
long index,
V value)
Set a value at the given index in the array stored at
key. |
@Experimental Long arset(K key, long index, V value)
key.key - the key of the array.index - the index to set.value - the value to store.@Experimental Long arset(K key, long index, V... values)
key.key - the key of the array.index - the starting index.values - the values to store at consecutive indices.@Experimental Long armset(K key, Map<Long,V> indexValueMap)
key.key - the key of the array.indexValueMap - map of index to value pairs.@Experimental V arget(K key, long index)
key.key - the key of the array.index - the index to get.null if the index is empty or the key does not exist.@Experimental List<V> armget(K key, long... indices)
key.key - the key of the array.indices - the indices to get.null for empty slots).@Experimental Long ardel(K key, long index)
This single-index overload provides boolean-like semantics ("was this element there?"), distinct from the multi-index varargs form which returns a count.
key - the key of the array.index - the index to delete.@Experimental Long ardel(K key, long... indices)
key - the key of the array.indices - the indices to delete.@Experimental Long ardelrange(K key, long start, long end)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).@Experimental Long ardelrange(K key, ArrayIndexRange... ranges)
key - the key of the array.ranges - one or more ranges to delete.@Experimental Long arlen(K key)
key - the key of the array.@Experimental Long arcount(K key)
key - the key of the array.@Experimental List<V> argetrange(K key, long start, long end)
null for empty slots.
The range must not exceed 1,000,000 items.
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).null for empty slots).@Experimental Long arnext(K key)
key - the key of the array.null if the cursor is exhausted.@Experimental List<V> arlastitems(K key, long count)
key - the key of the array.count - the number of items to return.@Experimental List<V> arlastitems(K key, long count, boolean rev)
key - the key of the array.count - the number of items to return.rev - true to return items in reverse insertion order, false for insertion order.@Experimental List<IndexedValue<V>> arscan(K key, long start, long end)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).IndexedValue pairs.@Experimental List<IndexedValue<V>> arscan(K key, long start, long end, long limit)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).limit - the maximum number of entries to return.IndexedValue pairs.@Experimental List<Long> argrep(K key, ArGrepArgs grepArgs)
key - the key of the array.grepArgs - the grep arguments (range, predicates, flags).@Experimental List<IndexedValue<V>> argrepWithValues(K key, ArGrepArgs grepArgs)
key - the key of the array.grepArgs - the grep arguments (range, predicates, flags).IndexedValue pairs.@Experimental V aropAggregate(K key, long start, long end, ArAggregateType operation)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).operation - the aggregate operation.null if the range is empty or values are non-numeric.@Experimental Long aropBitwise(K key, long start, long end, ArBitwiseType operation)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).operation - the bitwise operation.@Experimental Long aropCount(K key, long start, long end)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).@Experimental Long aropCount(K key, long start, long end, V matchValue)
key - the key of the array.start - the start index (inclusive).end - the end index (inclusive).matchValue - the value to match.@Experimental Long arinsert(K key, V value)
key - the key of the array.value - the value to insert.@Experimental Long arinsert(K key, V... values)
key - the key of the array.values - the values to insert.@Experimental Long arring(K key, long size, V value)
key - the key of the array.size - the ring buffer size.value - the value to insert.@Experimental Long arring(K key, long size, V... values)
key - the key of the array.size - the ring buffer size.values - the values to insert.@Experimental Long arseek(K key, long index)
key - the key of the array.index - the index to seek to.@Experimental ArrayInfo arinfo(K key)
ArrayInfo.getInfo();key - the key of the array.null if the key does not exist.@Experimental ArrayInfoFull arinfoFull(K key)
ArrayInfo.getInfo();key - the key of the array.null if the key does not exist.Copyright © 2026 lettuce.io. All rights reserved.