Redis的底层类型之list
文章目录
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 stopTrim an existing list so that it will contain only the specified range of elements specified.
- BLPOP
- BLMOVE
如果源列表为空,这两个指令会阻塞等待

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论