ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。
https://ckai.xyz
lists
Redis lists are linked lists of string values. Redis lists are frequently used to:
Redis 列表是由字符串值组成的链接列表。Redis 列表经常用于:
- Implement stacks and queues.实现堆栈和队列。
- Build queue management for background worker systems.构建后台工作者系统的队列管理。
常用命令
- LPUSH
adds a new element to the head of a list; RPUSH adds to the tail.
- LPOP
removes and returns an element from the head of a list; RPOP does the same but from the tails of a list.
- LLEN
- LMOVE
LMOVE source destination <LEFT | RIGHT> <LEFT | RIGHT>
atomically moves elements from one list to another.
-
LTRIM
LTRIM key start stop
Trim an existing list so that it will contain only the specified range of elements specified.
- BLPOP
- BLMOVE
如果源列表为空,这两个指令会阻塞等待