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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file diskq-1.0.0.tar.gz.

File metadata

  • Download URL: diskq-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for diskq-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e4f21343fa921e544115b54b5b3bb1ad662470d626e04802714ea9f04684a475
MD5 cb9f87656fd8705cf8de593780f989c7
BLAKE2b-256 aec2c0f1f6e9842166be924ff766ff3bf7f9a8ad31f7d39d63f07669d995a715

See more details on using hashes here.

Provenance

File details

Details for the file diskq-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: diskq-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for diskq-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fceea201f65468602db0c2f372c43958226f3270928ae12437a998bbb41c1ee
MD5 ac11c2aadac1340f86661b2a6c81a4b8
BLAKE2b-256 b8bc74842e6695f82b73c87d3689b406c6bc5bb2f3a3814cfb90f88dacfe98de

See more details on using hashes here.

Provenance

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