โ Redis learning pathRedis ยท Module 3 of 10
Lists and queues
Redis lists are ordered and work as simple queues and stacks.
๐ Key ideas
- LPUSH and RPUSH add items to the left or right end.
- LPOP and RPOP take an item from an end.
- LRANGE key 0 -1 reads the whole list.
- BRPOP waits (blocks) until an item arrives, which suits job queues.
- LTRIM keeps only the newest N items, useful for recent activity feeds.
๐ก Real-life example: Like a bus queue: people join at the back and the first in line boards first.
LPUSHAdd an item to the left end
RPOPRemove an item from the right end
LRANGERead a range of list items
BRPOPWait for an item, then remove it