tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

List Group

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-08-11 11:11:58
Traduzido por IA

Command Introduction

The List command family is designed to operate on the doubly linked list (quicklist) data structure. It is suitable for scenarios that follow First-In-First-Out (FIFO) or Last-In-First-Out (LIFO) principles, such as message queues, task scheduling, and timelines. Its core commands can be categorized into the following four types based on their features:
Insert and pop elements
LPUSH / RPUSH: inserts one or more elements from the left or right end.
LPOP / RPOP: pops an element from the end of the list.
LINSERT: inserts a new element before or after a specified element.
RPOPLPUSH: atomically pops an element from the tail of one list and pushes it to the head of another list.
Query and modify elements
LINDEX: reads the element at a specified position by its index.
LRANGE: returns a list of elements by range.
LSET: modifies the value of the element at a specified position by its index.
LLEN: returns the length of the list.
LREM: removes a specified number of matching elements.
LTRIM: retains a specified range and trims the remaining elements.
Blocking Operations (Message Queue Scenario)
BLPOP / BRPOP: performs blocking pops, waiting for a specified timeout when the list is empty, which is suitable for message queue consumption.
BRPOPLPUSH: performs a blocking pop and push to another list.
Enhanced Commands for Higher Versions (Redis 6.2+ / Valkey 8.0+)
LMOVE / BLMOVE: moves elements more flexibly between lists (supports specifying source/target direction).
LPOS: finds the position index of an element within a list.
LMPOP / BLMPOP (Redis 7.0+): pops elements in batches from multiple keys, further enhancing the capability of List as a lightweight task queue.
For more information, see the Valkey official documentation: List Command Group.

Command Support Overview

Basic Commands: lindex, linsert, llen, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, rpop, rpoplpush, rpush, rpushx, blpop, brpop, brpoplpush. These commands are supported by the standard architecture of Redis versions 2.8, 4.0, 5.0, 6.2, and 7.0, as well as the standard and cluster architectures of Valkey versions 8.0 and 9.0.
Commands Added in Version 6.2+: blmove, lmove, lpos. These commands are supported only by Redis versions 6.2 and 7.0, and Valkey versions 8.0 and 9.0.
Commands Added in Version 7.0+: lmpop, blmpop. These commands are supported only by Redis version 7.0, and Valkey versions 8.0 and 9.0.
Cross-Slot Restriction: In a cluster architecture, rpoplpush, blpop, brpop, and brpoplpush do not support cross-slot operations.

Command Compatibility Matrix

The support status of List family commands across different versions and architectures is shown in the table below (✓ indicates supported, ✗ indicates not supported, and — indicates that the command does not involve a cross-slot access scenario).
Note:
Commands with a 'b' prefix, such as blpop, brpop, brpoplpush, blmove, and blmpop, differ from their non-prefixed counterparts (such as lpop and lmove) in their behavior when a List is empty. The non-prefixed commands return nil immediately, whereas the 'b'-prefixed commands wait for a new element to be enqueued and return only upon timeout. Within a multi exec transaction, 'b'-prefixed commands do not wait, behaving identically to their non-prefixed counterparts. For more details, see the BLPOP official documentation.
Command
Valkey 9.0 Standard Architecture
Valkey 9.0 Cluster Architecture
Redis 7.0/Valkey 8.0 Standard Architecture
Redis 7.0/Valkey 8.0 Cluster Architecture
Redis 6.2 Standard Architecture
Redis 6.2 Cluster Architecture
Redis 5.0 Standard Architecture
Redis 5.0 Cluster Architecture
Redis 4.0 Standard Architecture
Redis 4.0 Cluster Architecture
Redis 2.8 Standard Architecture
Cluster Architecture Cross-Slot Support
lindex
linsert
llen
lpop
lpush
lpushx
lrange
lrem
lset
ltrim
rpop
rpoplpush
rpush
rpushx
blpop
brpop
brpoplpush
blmove
lpos
lmove
lmpop
blmpop

Ajuda e Suporte

Esta página foi útil?

comentários