blmove Command
Syntax: blmove list_name_source list_name_destination destination_left/right source_left/right time
Explanation: It blocks lmove cmd till the source is empty or till a client doesn’t push any value in it under given time constraints. In this example, first we made 2 different lists “WebTechStack” and “AppTechStack” then made them empty, as this cmd won’t work if source (WebTechStack) will contain any element. Then we executed the command, and it started waiting for client to push some values under given time “20s” then after timeout it showed ‘nil’ because no vale was pushed by client.
Example: blmove WebTechStack AppTechStack LEFT LEFT 20
Complete Guide to Redis Lists
When it comes to data structures, Redis offers a wide range of options to efficiently manage and manipulate your data and one of them is list. A list is an ordered collection of values associated with a unique index. Unlike arrays, Redis lists are not limited to a fixed size and can expand or shrink on per need basis. In real, it works like linked lists under the hood, which means adding or removing elements from the beginning or the end of the list is an efficient operation here having a time complexity of O(1) that is constant.
Important Topics for the Redis Lists
- Redis Lists Commands
- 1. keys Command
- 2. lpush Command
- 3. lrange Command
- 4. rpush Command
- 5. llen Command
- 6. lpop Command
- 7. rpop Command
- 8. lset Command
- 9. linsert Command
- 10. lindex Command
- 11. lpushx Command
- 12. rpushx Command
- 13. sort Command
- 14. lrem Command
- 16. ltrim Command
- 17. blpop Command
- 18. brpop Command
- 19. blmove Command
- 20. lmpop Command
- How to Treat a list like a queue?
- How to Treat a list like a stack?
- Conclusion