Skip to main content

Lightweight queue interfaces with Redis super powers for distributed and non-distributed systems

Project description

PimPamQueues

Lightweight queue interfaces with Redis super powers

Build status Latest Version Supported Python versions

Description

PimPamQueues provides easy and lightweight Python interfaces to interact with queues on a distributed system.

Requirements

Features

  • Supports Python 2.7, 3.4 and 3.5.

  • Provides super-simple queue interfaces for creating different types of queues.

  • Designed to be used on distributed systems - also works on non-distributed systems 😎.

Queue Interfaces

  • SimpleQueue, just a regular queue.

  • BucketQueue, unordered queue of unique elements with a extremely fast element existence search method.

  • SmartQueue, queue which stores queued elements aside the queue for not queueing the same incoming elements again.

Installation

PIP

For a pip installation, just pip install pimpamqueues

$ pip install pimpamqueues

Usage

SimpleQueue

>>> from pimpamqueues.simplequeue import SimpleQueue
>>> queue = SimpleQueue(id_args=['simplequeue'])
>>> queue.num()
0
>>> queue.push('egg')
1
>>> queue.push_some(['bacon', 'spam'])
3
>>> queue.num()
3
>>> queue.pop()
b'egg'
>>> queue.is_empty()
False
>>> queue.push('spam', to_first=True)
3
>>> queue.elements()
[b'spam', b'bacon', b'spam']
>>> queue.pop()
b'spam'
>>> queue.elements()
[b'bacon', b'spam']
...

BucketQueue

>>> from pimpamqueues.bucketqueue import BucketQueue
>>> queue = BucketQueue(id_args=['bucketqueue'])
>>> queue.num()
0
>>> queue.push('egg')
'egg'
>>> queue.push_some(['bacon', 'spam'])
[b'bacon', b'spam']
>>> queue.num()
3
>>> queue.pop()
b'spam'
>>> queue.is_empty()
False
>>> queue.push('spam')
'spam'
>>> queue.elements()
{b'bacon', b'egg', b'spam'}
>>> queue.pop()
b'spam'
>>> queue.elements()
{b'bacon', b'egg'}
...

SmartQueue

>>> from pimpamqueues.smartqueue import SmartQueue
>>> queue = SmartQueue(id_args=['smartqueue'])
>>> queue.num()
0
>>> queue.push('egg')
'egg'
>>> queue.push_some(['bacon', 'spam'])
[b'bacon', b'spam']
>>> queue.num()
3
>>> queue.pop()
b'egg'
>>> queue.is_empty()
False
>>> queue.push('spam', to_first=True)
''
>>> queue.elements()
[b'bacon', b'spam']
>>> queue.pop()
b'bacon'
>>> queue.elements()
[b'spam']
>>> queue.push('spam', force=True)
'spam'
>>> queue.push_some(['spam', 'spam'], force=True)
[b'spam', b'spam']
>>> queue.elements()
[b'spam', b'spam', b'spam', b'spam']
...

History

1.0.1 (2015-01-28)

  • Python required packages are included to resolve installation dependencies.

1.0.0 (2015-01-27)

  • Hello PimPamQueues.

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

pimpamqueues-1.0.2.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file pimpamqueues-1.0.2.tar.gz.

File metadata

File hashes

Hashes for pimpamqueues-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7887d8e28a21929148cb2b1d676fedff4a922f60850571f2ba3615e6ecc0d2f7
MD5 d69ec93d62b693f4c2d72b5c544c1f18
BLAKE2b-256 d5f069b25353b82993e735dcff9f192c16cd405a69cd4d46b92617fe08547a55

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