Skip to main content

Queue Implementation with Redis

Project description

https://img.shields.io/badge/License-GPL%20v3-blue.svg https://badge.fury.io/py/moonqueue.svg https://img.shields.io/travis/Gatsby-Lee/moonqueue.svg

moonqueue

MoonQueue is another Queue Library using Redis as storage.

How to Install

pip install moonqueue

How To Use

RedisQueueList - One Queue

>>> from moonqueue import RedisQueueList
>>> r = RedisQueueList('list:myqueue')

# push one message
>>> r.push(['apple'])
(('list:myqueue', 1),)
>>> r.pop()
('list:myqueue', b'apple')

# push multiple messages
>>> r.push(['apple', 'banana'])
(('list:myqueue', 2),)
>>> r.pop()
('list:myqueue', b'apple')
>>> r.pop()
('list:myqueue', b'banana')
>>> r.pop()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/web/moonqueue/moonqueue/redis_queue_list.py", line 52, in pop
    raise EmptyQueueException(excep_msg)
moonqueue.excep.EmptyQueueException: list:myqueue is empty

RedisQueueList - Two Queues

>>> from moonqueue import RedisQueueList
>>> r = RedisQueueList(['list:myqueue1', 'list:myqueue2'])
>>> r.get_queues()
['list:myqueue1', 'list:myqueue2']

# push one message - it will be pused to all queues
>>> r.push(['apple'])
(('list:myqueue1', 1), ('list:myqueue2', 1))

# pop from queues
>>> r.pop()
('list:myqueue1', b'apple')
>>> r.pop()
('list:myqueue2', b'apple')
>>> r.pop()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/web/moonqueue/moonqueue/redis_queue_list.py", line 52, in pop
    raise EmptyQueueException(excep_msg)
moonqueue.excep.EmptyQueueException: ['list:myqueue1', 'list:myqueue2'] is empty

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moonqueue-0.3.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

moonqueue-0.3.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file moonqueue-0.3.1.tar.gz.

File metadata

  • Download URL: moonqueue-0.3.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for moonqueue-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b3c43c902d6b57e6e38f74c3dc1d832d8f609fc71b141286ff239577af31f8f4
MD5 4476ebe9426349b4dd613266fb4f2896
BLAKE2b-256 c2149741b42796efbbd3dd456b8880bdb78384d94456ffc4503ffe52c6142d74

See more details on using hashes here.

File details

Details for the file moonqueue-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: moonqueue-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for moonqueue-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b66c3d5e64b69cf31ba7f21c7ecc7143ec9e11de75aaa58a124b6cd0ed64299
MD5 37b9b5cd8521cd1b9b49a471e61624ce
BLAKE2b-256 3f6a78492cf98d040028140f9fad4f464888e9417bd8acd13a6c79c0f3355b9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page