It's really boring to write a very small Python program that implements the code to emulate a Redis queue: Redis_lpush.py #!/usr/bin/python3import timeimport redis def Handle (Info): Print (info) Time.sleep (2) def main (): pool = Redis. ConnectionPool (host= ' localhost ', port=6379, db=0) r = Redis. Redis (connection_pool=pool) i = 0 while I < 30: i + = 1   ; R.lpush (' Task ', i) handle (i) if __name__ = = "__main__": Main () & Nbsp; redis_brpop.py #!/usr/bin/python3import timeimport redis def handle (Info): Print (info) Time.sleep (2) def main (): Pool = redis. ConnectionPool (host= ' localhost ', port=6379, db=0) R = redis. Redis (connection_pool=pool) while 1: result = r.brpop (' Task ', 0) &NBSP Handle (result[1]) if __name__ == "__main__": Main () final effect such as:
Have the same person as me--half a day before the holiday do not know what to do, some words to raise a hand ~ ~ ~
Python combined with Redis simulation queue