โ† Redis learning path
Redis ยท Module 3 of 10

Lists and queues

Redis lists are ordered and work as simple queues and stacks.

๐Ÿ“– Key ideas

  1. LPUSH and RPUSH add items to the left or right end.
  2. LPOP and RPOP take an item from an end.
  3. LRANGE key 0 -1 reads the whole list.
  4. BRPOP waits (blocks) until an item arrives, which suits job queues.
  5. 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