{ "info": { "author": "Yordano Gonzalez Fernandez", "author_email": "yorda891216@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "redis-sort-queue\n================\n\nredis-sort-queue is a priority queue for easy use on redis\n\nInstallation\n------------\n\nThe easiest way to install the redis-sort-queue package is either via\npip:\n\n::\n\n $ pip install redis-sort-queue\n\nor manually by downloading the source and run the setup.py script:\n\n::\n\n $ python setup.py install\n\nExamples\n--------\n\nWe have put some self-explanatory examples in the\n`examples `__\ndirectory, but here is a quick example on how to get started. Assuming\nthe installation was successful, you can import the redis-sort-queue\npackage like this:\n\nThen, create an instance of **RedisQueue**:\n\n.. code:: python\n\n from redis_sort_queue import RedisQueue\n\n.. code:: python\n\n queue = RedisQueue('name_queue')\n queue.push(100, \"element1\",1, \"element2\")\n element=queue.pop()\n\nYou can use **datetime** as priority :\n\n.. code:: python\n\n from redis_sort_queue import RedisQueue\n from datetime import datetime\n\n queue = RedisQueue('name_queue')\n queue.push(datetime.now(), \"element1\",1, \"element2\")\n\nIf you want to use multiple queues you must create an instance of\n**CollectionQueues** :\n\n.. code:: python\n\n from redis_sort_queue import RedisQueue, CollectionQueues\n\n.. code:: python\n\n queue1 = RedisQueue('A')\n queue2 = RedisQueue('B')\n queue1.push(100, \"E\",1, \"L\")\n queue2.push(101, \"T\")\n\n.. code:: python\n\n collection=CollectionQueues()\n queue3= collection.intersect_queues('intersect1',['A','B'])\n\nIf you want to use pool connection **ConnectionPool** :\n\n.. code:: python\n\n from redis_sort_queue import RedisQueue, CollectionQueues, ConnectionPool\n\n.. code:: python\n\n pool = ConnectionPool(host='127.0.0.1', port=6379)\n\n.. code:: python\n\n queue1 = RedisQueue('A',connection_pool=pool)\n queue2 = RedisQueue('B',connection_pool=pool)\n queue1.push(100, \"E\",1, \"L\")\n queue2.push(101, \"T\",datetime.now(), 10)\n\n collection=CollectionQueues(connection_pool=pool)\n queue3= collection.intersect_queues('intersect1',['A','B'])\n element=queue.pop()\n\nAPI library\n-----------\n\nMethods defined here:\n\n| **clean** ``python clean(self)``\n| Delete all values in queue\n\n**count**\n\n.. code:: python\n\n count(self)\n\nReturn the number of elements in the queue\n\n**count\\_lex**\n\n.. code:: python\n\n count_lex(self, min, max)\n\nReturn the number of items in the queue between the lexicographical\nrange **min** and **max**.\n\n**count\\_priority**\n\n.. code:: python\n\n count_priority(self, min, max)\n\nReturns the number of elements in the queue with a score between **min**\nand **max**.\n\n| **incr\\_priority** ``python incr_priority(self, value, amount=1)``\n| Increment the score of **value** in queue by **amount**\n\n**list**\n\n.. code:: python\n\n list(self, start=0, end=-1, desc=False, withscores=False, score_cast_func=type float)\n\nReturn a range of values from queue between **start** and **end** sorted\nin ascending order.\n\n**start** and **end** can be negative, indicating the end of the range.\n\n**desc** a boolean indicating whether to sort the results descendingly\n\n**withscores** indicates to return the scores along with the values. The\nreturn type is a list of (value, score) pairs\n\n**score\\_cast\\_func** a callable used to cast the score return value\n\n**list\\_by\\_lex**\n\n.. code:: python\n\n list_by_lex(self, min, max, start=None, num=None)\n\nReturn the lexicographical range of values from sorted queue between\n**min** and **max**.\n\nIf **start** and **num** are specified, then return a slice of the\nrange.\n\n**list\\_by\\_priority**\n\n.. code:: python\n\n list_by_priority(self, min, max, start=None, num=None, withscores=False, score_cast_func=)\n\nReturn the lexicographical range of values from sorted queue between\n**min** and **max**.\n\nIf **start** and **num** are specified, then return a slice of the\nrange.\n\n**pop**\n\n.. code:: python\n\n pop(self, desc=False)\n\nRemove the first member **values** from queue ordered **desc**\n\n**push**\n\n.. code:: python\n\n push(self, *args, **kwargs)\n\nSet any number of score, element-name pairs to the queue. Pairs can be\nspecified in two ways:\n\nAs \\*args, in the form of: score1, name1, score2, name2, ...\n\nThe following example would add two values to the queue: redis.push(\n1.1, 'name1', 2.2, 'name2')\n\n**remove**\n\n.. code:: python\n\n remove(self, *values)\n\nRemove member values from queue", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yordanglez/redis-sort-queue", "keywords": "Redis,Queue,Priority,Sort", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "redis-sort-queue", "package_url": "https://pypi.org/project/redis-sort-queue/", "platform": "linux", "project_url": "https://pypi.org/project/redis-sort-queue/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/yordanglez/redis-sort-queue" }, "release_url": "https://pypi.org/project/redis-sort-queue/1.3.3/", "requires_dist": null, "requires_python": null, "summary": "ordered queue for redis", "version": "1.3.3" }, "last_serial": 2894056, "releases": { "1.3.3": [ { "comment_text": "", "digests": { "md5": "0758dcd3e817c6af261718ace5aeb386", "sha256": "e551667e0c267269fda1e47c6690eefffd0638432d6f662ab9c5dee376fed0ba" }, "downloads": -1, "filename": "redis-sort-queue-1.3.3.tar.gz", "has_sig": false, "md5_digest": "0758dcd3e817c6af261718ace5aeb386", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4236, "upload_time": "2017-05-23T19:01:53", "url": "https://files.pythonhosted.org/packages/83/df/c16a10bb9b384e8246932d431d5ecd2bf817223f16ac2300b91a65dfe82a/redis-sort-queue-1.3.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0758dcd3e817c6af261718ace5aeb386", "sha256": "e551667e0c267269fda1e47c6690eefffd0638432d6f662ab9c5dee376fed0ba" }, "downloads": -1, "filename": "redis-sort-queue-1.3.3.tar.gz", "has_sig": false, "md5_digest": "0758dcd3e817c6af261718ace5aeb386", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4236, "upload_time": "2017-05-23T19:01:53", "url": "https://files.pythonhosted.org/packages/83/df/c16a10bb9b384e8246932d431d5ecd2bf817223f16ac2300b91a65dfe82a/redis-sort-queue-1.3.3.tar.gz" } ] }