Skip to main content

DiskQ is a Python package that provides persistent queues using disk storage

Project description

DiskQ

codecov PyPI PyPI - Python Version Downloads GitHub top language GitHub stars https://blog.csdn.net/flower_drop autofix enabled

DiskQ is a Python library for persistent queue management. It allows you to store queue data on disk, making it easier to manage your data and prevent data loss in the event of system crashes or power outages.

Installation

You can install DiskQ using pip:

pip install diskq

Usage

PersistentQueue

The PersistentQueue class is used to create a persistent queue. Here's an example:

from diskq import PersistentQueue

# create a new persistent queue
queue = PersistentQueue('my_queue.pkl')

# add items to the queue
queue.put('item1')
queue.put('item2')
queue.put('item3')

# get items from the queue
item1 = queue.get()
item2 = queue.get()
item3 = queue.get()

PersistentPriorityQueue

The PersistentPriorityQueue class is used to create a persistent priority queue. Here's an example:

from diskq import PersistentPriorityQueue

# create a new persistent priority queue
queue = PersistentPriorityQueue('my_priority_queue.pkl')

# add items to the queue with priorities
queue.put((1, 'item1'))
queue.put((2, 'item2'))
queue.put((3, 'item3'))

# get items from the queue in order of priority
item1 = queue.get()
item2 = queue.get()
item3 = queue.get()

PersistentLifoQueue

The PersistentLifoQueue class is used to create a persistent last-in, first-out (LIFO) queue. Here's an example:

from diskq import PersistentLifoQueue

# create a new persistent LIFO queue
queue = PersistentLifoQueue('my_lifo_queue.pkl')

# add items to the queue
queue.put('item1')
queue.put('item2')
queue.put('item3')

# get items from the queue in reverse order
item3 = queue.get()
item2 = queue.get()
item1 = queue.get()

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

diskq-1.0.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

diskq-1.0.0-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

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