{ "info": { "author": "LI Mengxiang", "author_email": "limengxiang876@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Fastrq - Queue, Stack and Priority Queue built on Redis\n\n[![Build Status](https://travis-ci.org/limen/fastrq.svg?branch=master)](https://travis-ci.org/limen/fastrq)\n\n[Fastrq for PHP](https://github.com/limen/fastrq-php)\n\n## Features\n\n+ Abstract Queue, Deque, Capped Queue/Deque, and Overflow-able Capped Queue/Deque\n+ Abstract Stack, Capped Stack\n+ Abstract Priority Queue, Capped Priority Queue and Overflow-able Capped Priority Queue\n+ Push and Pop support batch operation\n+ Using Lua scripts to save RTT (Round Trip Time)\n+ Support getting indexes of members \n+ Support pushing only if a member not already inside the queue\n+ Support pushing only if the queue already exists/not already exist\n+ All operations are `atomic`\n\n## Requirements\n\n- Redis >=3.0.2\n- Python 2.7 or >=3.4\n\n## Installation\n\nvia pip\n\n```\npip install fastrq\n```\n\nor from source\n\n```\npython setup.py install\n```\n\n## Usage\n\n```python\nfrom fastrq.queue import Queue, CappedQueue\nfrom fastrq.deque import Deque\nfrom fastrq.stack import Stack\nfrom fastrq.priorityqueue import PriorityQueue\n\n# queue\nq = Queue(\"fastrq_queue\")\nq.push(1)\nq.push([2, 3])\nq.push_ni(1) # got [3, False]. `ni` stands `not inside`\nq.push_ae(1) # got 4. `ae` stands `already exists`\nq.push_ne(1) # got False. `ne` stands `not already exist`\nq.ttl(10) # set the lifetime in seconds\nq.range(0, -1) # got ['1', '2', '3']\nq.range(0, 1) # got ['1', '2']\nq.indexof_one(1); # got 0\nq.indexof_one(2); # got 1\nq.indexof_one(4); # got None\nq.indexof_many([1, 2, 4]); # got {1: 0, 2: 1, 4: None}\n# push only if the member not inside the queue\nq.push_ni(4) # got [4, True]\nq.pop()\nq.pop(2)\nq.destruct() # destruct the queue\ncq = CappedQueue(\"fastrq_capped_queue\", 3)\ncq.push(1)\ncq.push(2)\ncq.push([3, 4]) # got \"err_qof\"\ncq.push(3)\ncq.push(4) # got \"err_qf\"\nof_cq = OfCappedQueue(\"fastrq_of_capped_queue\", 3)\nof_cq.push(1)\nof_cq.push([2, 3, 4]) # \"1\" would be forced out\n\n\n# deque\ndq = Deque(\"fastrq_deque\")\ndq.push_front([1, 2])\ndq.push_back([3, 4])\ndq.pop_front()\ndq.pop_back()\ndq.push_front_ni(3)\ndq.push_back_ni(5)\n\n# priority queue\npq = PriorityQueue(\"fastrq_priority_queue\")\npq.push({'alibaba': 1})\npq.push({'google': 0, 'microsoft': 2})\npq.indexof_one('google'); # got 0\npq.indexof_one('alibaba'); # got 1\npq.indexof_one('baidu'); # got None\npq.pop()\npq.pop(2)\npq.push_ni('ibm', 4)\npq.push_ni('amazon', 5)\n\n# stack\ns = Stack(\"fastrq_stack\")\ns.push([1,2,3])\ns.indexof_one(1); # got 2\ns.indexof_one(2); # got 1\ns.indexof_one(3); # got 0\ns.pop()\ns.push_ni(4)\n\n```\n\n## Data types\n\n### Queue\n\n+ first in and first out\n+ unlimited capacity\n+ support batch push and batch pop\n\n### Deque\n\nDerive from queue with more features\n\n+ support push front and push back\n+ support pop front and pop back\n\n### Capped Queue/Deque\n\nDerive from queue/deque with more features\n\n+ Have fixed capacity\n+ Push to a full one would fail\n+ Push to one whose positions are not enough would fail\n\n### Overflow-able Capped Queue/Deque\n\nDerive from capped queue/deque with more features\n\n+ The queue length would never exceed its capacity\n+ Push to an end would force out from the other end if one is full\n\n### Stack\n\n+ Last in and First out\n+ Unlimited capacity\n+ Support batch push and batch pop\n\n### Capped Stack\n\nDerive from Stack with more features\n\n+ Have fixed capacity\n+ Push to a full capped stack would fail\n+ Push to a capped stack whose positions are not enough would fail\n\n### Priority Queue\n\n+ The lower the score, the higher the priority\n+ Unlimited capacity\n+ Support batch push and batch pop\n\n### Capped Priority Queue\n\nDerive from Priority Queue with more features\n\n+ Have fixed capacity\n+ Push to a full one would fail\n+ Push to a capped one whose positions are not enough would fail\n\n### Overflow-able Capped Priority Queue\n\nDerive from Capped Priority Queue with more features\n\n+ The queue length would never exceed its capacity\n+ Push to would force out the lowest priority if queue is full\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/limen/fastrq", "keywords": "", "license": "MIT", "maintainer": "LI Mengxiang", "maintainer_email": "limengxiang876@gmail.com", "name": "fastrq", "package_url": "https://pypi.org/project/fastrq/", "platform": "any", "project_url": "https://pypi.org/project/fastrq/", "project_urls": { "Homepage": "https://github.com/limen/fastrq" }, "release_url": "https://pypi.org/project/fastrq/0.2.0/", "requires_dist": [ "redis" ], "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "Queue, Stack and Priority Queue built on Redis", "version": "0.2.0" }, "last_serial": 4652054, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b2e8da780c858ccda43c9b9317f1432c", "sha256": "34cd1a8bd141607368c7a8ffec54008d9c35366dfcade727cc9cfca83b430449" }, "downloads": -1, "filename": "fastrq-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b2e8da780c858ccda43c9b9317f1432c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 6410, "upload_time": "2018-11-24T09:43:56", "url": "https://files.pythonhosted.org/packages/d6/54/516251e8a066e7a3b4f48171ab0f72113326fce12b28842612223f26d4bf/fastrq-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bbcab61c47bb73eadad0340ebc5096e0", "sha256": "4b3bb179028ecf5a52f91421b20f592701ad970a30c075a9b5308fb263a81f44" }, "downloads": -1, "filename": "fastrq-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bbcab61c47bb73eadad0340ebc5096e0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 4001, "upload_time": "2018-11-24T09:43:58", "url": "https://files.pythonhosted.org/packages/25/61/22fbf7f52f6d42b9ed0c82b45b25a88d1c60107501ab64548e931737b8e8/fastrq-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "83f9862502e091e7af5efbf3d45ac706", "sha256": "6edc39b1bdf23edb7c7787f95c8097290bd27ce2c6f8d1a81ab679d62814561d" }, "downloads": -1, "filename": "fastrq-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "83f9862502e091e7af5efbf3d45ac706", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 6845, "upload_time": "2018-11-24T10:35:03", "url": "https://files.pythonhosted.org/packages/63/c1/14a818e81bd509db9944b6c4c67623529af12c134a6bf689f42c85777eb1/fastrq-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0dc39b845cc779b7894d0d525029d06d", "sha256": "b36f2e369bc45aefdcf510eaec7c41fbfa408912b7c441c458108908261b7ced" }, "downloads": -1, "filename": "fastrq-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0dc39b845cc779b7894d0d525029d06d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 4440, "upload_time": "2018-11-24T10:35:05", "url": "https://files.pythonhosted.org/packages/cc/aa/b5efb7a1b0b0bc16679f532f35ad3ea783bbc43db469937e352debc69681/fastrq-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "237d6395f39a0f4f4b532a4952526f01", "sha256": "b2899f079f6160f35bbed8ba9c896888bdd8a96489396cfc7cd8d583f946fd88" }, "downloads": -1, "filename": "fastrq-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "237d6395f39a0f4f4b532a4952526f01", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 8371, "upload_time": "2018-12-01T13:46:09", "url": "https://files.pythonhosted.org/packages/97/7b/ee606ce6b6209d4ae0de0e4d03270f1c1480830d82e03cc46e639537345b/fastrq-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "311c09f755a2803dba37e8b27a96de97", "sha256": "e6a6528d1b2efc92ed0a38e20104ea06b5b59f1f214539f66a66b4885b8cf711" }, "downloads": -1, "filename": "fastrq-0.1.2.tar.gz", "has_sig": false, "md5_digest": "311c09f755a2803dba37e8b27a96de97", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 5713, "upload_time": "2018-12-01T13:46:10", "url": "https://files.pythonhosted.org/packages/09/ad/0e0a827537f086eb166e310c32b397c084c3192570afe16f0eea1178a17b/fastrq-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "4c6bac37b84932155b96dc2520fd9669", "sha256": "0b35531dd41bfedf5734fe0762c9294331c9bb2e0c98a810daab85ede2f3dce0" }, "downloads": -1, "filename": "fastrq-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4c6bac37b84932155b96dc2520fd9669", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 8624, "upload_time": "2018-12-02T04:09:49", "url": "https://files.pythonhosted.org/packages/4e/c6/8bb0107f7f1317575ec491bbd6036debfcadbdfb44bd66a03cbb1ea0f499/fastrq-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "982719919c7bfe1a3a19de6e3180c7a8", "sha256": "afcfaf4bdc486ff1ad7474cd34ae9cc3f7b32ee7bb15a3bb7228c783ae5dc843" }, "downloads": -1, "filename": "fastrq-0.1.3.tar.gz", "has_sig": false, "md5_digest": "982719919c7bfe1a3a19de6e3180c7a8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 5823, "upload_time": "2018-12-02T04:09:50", "url": "https://files.pythonhosted.org/packages/8c/44/52c138afcf37159653e1a7f6efe10818267b73089e0f7ada131f1adedd25/fastrq-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "dce48d0e3bd48bdbfea84f2fc4fa51e4", "sha256": "909ba63b3630057e8319ed9818c935cf47ad44973cf9186c4cdc09c22152746b" }, "downloads": -1, "filename": "fastrq-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dce48d0e3bd48bdbfea84f2fc4fa51e4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 12766, "upload_time": "2019-01-02T08:31:56", "url": "https://files.pythonhosted.org/packages/45/c6/6249ca26565817b66874b645dec8af80185d6c0f1d59d662b23adf9b97c8/fastrq-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3de52b9215895f9bd9dc234dd9bd535b", "sha256": "007ea721b0c189a66942a506c9c05666d0bdf4e7452123cc404149e99981b5a2" }, "downloads": -1, "filename": "fastrq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "3de52b9215895f9bd9dc234dd9bd535b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10271, "upload_time": "2019-01-02T08:31:58", "url": "https://files.pythonhosted.org/packages/5a/01/c791bd98f03f7d5dff086bc6f397e619afde2cc979aaf7f7f1d2ebe12abb/fastrq-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dce48d0e3bd48bdbfea84f2fc4fa51e4", "sha256": "909ba63b3630057e8319ed9818c935cf47ad44973cf9186c4cdc09c22152746b" }, "downloads": -1, "filename": "fastrq-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dce48d0e3bd48bdbfea84f2fc4fa51e4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 12766, "upload_time": "2019-01-02T08:31:56", "url": "https://files.pythonhosted.org/packages/45/c6/6249ca26565817b66874b645dec8af80185d6c0f1d59d662b23adf9b97c8/fastrq-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3de52b9215895f9bd9dc234dd9bd535b", "sha256": "007ea721b0c189a66942a506c9c05666d0bdf4e7452123cc404149e99981b5a2" }, "downloads": -1, "filename": "fastrq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "3de52b9215895f9bd9dc234dd9bd535b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 10271, "upload_time": "2019-01-02T08:31:58", "url": "https://files.pythonhosted.org/packages/5a/01/c791bd98f03f7d5dff086bc6f397e619afde2cc979aaf7f7f1d2ebe12abb/fastrq-0.2.0.tar.gz" } ] }