A persistent, (mostly) atomic queue (like deque or Queue) implemented with redis backing.
Project description
- redis_queue is useful for implementing a multi-producer,
multi-consumer job queue. While it doesn’t have all the handy blocking and locking features of Queue, it does have the advantages of being multi-process safe and persistant.
- Example Usage:::
>>> from redis import Redis >>> from redis_queue import Queue >>> redis = Redis(host='127.0.0.1', port=6379) >>> queue = Queue(redis, 'test_queue') >>> queue.append('one') >>> queue.append('two') >>> queue.append('three') >>> queue.pop() 'three' >>> queue.pop() 'two' >>> queue.pop() 'one' >>> queue.append('one') >>> queue.append('two') >>> queue.append('three') >>> queue.popleft() 'one' >>> queue.popleft() 'two' >>> queue.popleft() 'three'