{ "info": { "author": "Ben Jolitz", "author_email": "ben.jolitz+trollius_redis@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Database" ], "description": "Redis client for Python trollius\n===========================================================================\n(ported from `asyncio-redis`_)\n\n|Build Status| |Wheel Status| |Doc Status|\n\n\n\nSupports\n---------\n- CPython 2.7, 3.3-3.5\n- PyPy\n- PyPy3\n\n\nDescription\n------------\n\n\nRedis client for the `PEP 3156`_ Python event loop ported to Trollius.\n\n.. _PEP 3156: http://legacy.python.org/dev/peps/pep-3156/\n\nThis Redis library is a completely asynchronous, non-blocking client for a\nRedis server. It depends on trollius (asyncio compatible for PEP 3156). It\nsupports Python 2 and 3 Trollius-using developers.\n\nIf you're new to asyncio, it can be helpful to check out\n`the asyncio documentation`_ first.\n\n.. _the asyncio documentation: http://docs.python.org/dev/library/asyncio.html\n\nTo see the original awesome driver that I ported from, I advise you to take a look at Jonathan Slenders `asyncio-redis`_.\n\n.. _asyncio-redis: https://github.com/jonathanslenders/asyncio-redis.git\n\n\nFeatures\n--------\n\n- Works for the trollius asyncio-compatible (PEP3156) event loop\n- No dependencies except trollius\n- Connection pooling\n- Automatic conversion from unicode (Python) to bytes (inside Redis.)\n- Bytes and str protocols.\n- Completely tested\n- Blocking calls and transactions supported\n- Streaming of some multi bulk replies\n- Pubsub support\n\n\nInstallation\n------------\n\n.. code::\n\n pip install trollius-redis\n\nDocumentation\n-------------\n\nView documentation at `read-the-docs`_\n\n.. _read-the-docs: http://trollius-redis.readthedocs.org/en/latest/\n\n\nThe connection class\n--------------------\n\nA ``trollius_redis.Connection`` instance will take care of the connection and\nwill automatically reconnect, using a new transport when the connection drops.\nThis connection class also acts as a proxy to a ``trollius_redis.RedisProtocol``\ninstance; any Redis command of the protocol can be called directly at the\nconnection.\n\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n @trollius.coroutine\n def example():\n # Create Redis connection\n connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))\n\n # Set a key\n yield From(connection.set(u'my_key', u'my_value'))\n\n # When finished, close the connection.\n connection.close()\n\n if __name__ == '__main__':\n loop = trollius.get_event_loop()\n loop.run_until_complete(example())\n\n\nConnection pooling\n------------------\n\nRequests will automatically be distributed among all connections in a pool. If\na connection is blocking because of --for instance-- a blocking rpop, another\nconnection will be used for new commands.\n\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n @trollius.coroutine\n def example():\n # Create Redis connection\n connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))\n\n # Set a key\n yield From(connection.set(u'my_key', u'my_value'))\n\n # When finished, close the connection pool.\n connection.close()\n\n\nTransactions example\n--------------------\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n @trollius.coroutine\n def example():\n # Create Redis connection\n connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))\n\n # Create transaction\n transaction = yield From(connection.multi())\n\n # Run commands in transaction (they return future objects)\n f1 = yield From(transaction.set(u'key', u'value'))\n f2 = yield From(transaction.set(u'another_key', u'another_value'))\n\n # Commit transaction\n yield From(transaction.execute())\n\n # Retrieve results\n result1 = yield From(f1)\n result2 = yield From(f2)\n\n # When finished, close the connection pool.\n connection.close()\n\nIt's recommended to use a large enough poolsize. A connection will be occupied\nas long as there's a transaction running in there.\n\n\nPubsub example\n--------------\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n @trollius.coroutine\n def example():\n # Create connection\n connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))\n\n # Create subscriber.\n subscriber = yield From(connection.start_subscribe())\n\n # Subscribe to channel.\n yield From(subscriber.subscribe([u'our-channel']))\n\n # Inside a while loop, wait for incoming events.\n while True:\n reply = yield From(subscriber.next_published())\n print(u'Received: ', repr(reply.value), u'on channel', reply.channel)\n\n # When finished, close the connection.\n connection.close()\n\n\nLUA Scripting example\n---------------------\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n code = \\\n u\"\"\"\n local value = redis.call('GET', KEYS[1])\n value = tonumber(value)\n return value * ARGV[1]\n \"\"\"\n\n @trollius.coroutine\n def example():\n connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))\n\n # Set a key\n yield From(connection.set(u'my_key', u'2'))\n\n # Register script\n multiply = yield From(connection.register_script(code))\n\n # Run script\n script_reply = yield From(multiply.run(keys=[u'my_key'], args=[u'5']))\n result = yield From(script_reply.return_value())\n print(result) # prints 2 * 5\n\n # When finished, close the connection.\n connection.close()\n\n\nExample using the Protocol class\n--------------------------------\n\n.. code:: python\n\n import trollius\n from trollius import From\n import trollius_redis\n\n @trollius.coroutine\n def example():\n loop = trollius.get_event_loop()\n\n # Create Redis connection\n transport, protocol = yield From(loop.create_connection(\n trollius_redis.RedisProtocol, u'localhost', 6379))\n\n # Set a key\n yield From(protocol.set(u'my_key', u'my_value'))\n\n # Get a key\n result = yield From(protocol.get(u'my_key'))\n print(result)\n\n # Close transport when finished.\n transport.close()\n\n if __name__ == '__main__':\n trollius.get_event_loop().run_until_complete(example())\n\n\n.. |Build Status| image:: https://travis-ci.org/benjolitz/trollius-redis.svg?branch=master\n :target: https://travis-ci.org/benjolitz/trollius-redis\n :alt: Build Status from Travis-CI\n\n\n.. |Wheel Status| image:: https://pypip.in/wheel/trollius_redis/badge.svg\n :target: https://pypi.python.org/pypi/trollius_redis/\n :alt: Wheel Status\n\n.. |Doc Status| image:: https://readthedocs.org/projects/trollius-redis/badge/?version=latest\n :target: https://readthedocs.org/projects/trollius-redis/?badge=latest\n :alt: Documentation Status", "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/benjolitz/trollius-redis", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "trollius_redis", "package_url": "https://pypi.org/project/trollius_redis/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/trollius_redis/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/benjolitz/trollius-redis" }, "release_url": "https://pypi.org/project/trollius_redis/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "PEP 3156 implementation of the redis protocol.", "version": "0.1.4" }, "last_serial": 1513710, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "36e8d3ca7ab0a7fd8cf0a698da0aee27", "sha256": "1761e6fa0ca16e58b14f0222b5418bccd14f297c9d30743cb5b65eaec01b0f60" }, "downloads": -1, "filename": "trollius_redis-0.0.1.tar.gz", "has_sig": false, "md5_digest": "36e8d3ca7ab0a7fd8cf0a698da0aee27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31496, "upload_time": "2015-04-16T01:58:26", "url": "https://files.pythonhosted.org/packages/4c/7d/d70cf9e51bdf7146ff050c6077d199c2293713822f27198d04c9664c7f20/trollius_redis-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "7039180971951dddc91535f8eca65b3a", "sha256": "19698ad46f0f3677c7b409feba811c887db479e999f5cab300f0eba4c3630aae" }, "downloads": -1, "filename": "trollius_redis-0.0.2.tar.gz", "has_sig": false, "md5_digest": "7039180971951dddc91535f8eca65b3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31542, "upload_time": "2015-04-16T02:18:34", "url": "https://files.pythonhosted.org/packages/a4/09/d42ff8065f61fc46f5bb347946e754d5d8c0ab73ed58879c99492bdc01a1/trollius_redis-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "ed8d26c45ca0c938617dc3ef3f967fb9", "sha256": "dbabb47e704c4aa4a9918d736bbaa3fba7a633a6417d153900faac02a0580d08" }, "downloads": -1, "filename": "trollius_redis-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ed8d26c45ca0c938617dc3ef3f967fb9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31549, "upload_time": "2015-04-16T02:20:33", "url": "https://files.pythonhosted.org/packages/00/d7/d274b0e9d06153b09fb4718f2d9fa8eb1f9a29f775b5854ee4462c040571/trollius_redis-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "e10963ad345dcbf78469adefd8c37a2b", "sha256": "bba4ee586994c6d197079fd7b8028e547d5a44bb226f77f6c162c7704f24d108" }, "downloads": -1, "filename": "trollius_redis-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e10963ad345dcbf78469adefd8c37a2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31873, "upload_time": "2015-04-16T18:53:39", "url": "https://files.pythonhosted.org/packages/d6/a8/081802beb674d641a17dec4e0b5beed584ba23331d00e12aed2afc46ac4c/trollius_redis-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d590c9b594cf2ddadddb77abdcb74653", "sha256": "2c5b340eb8e2b4bbe573b86f950b017d2fa8beddae31f83f2da8ee300e291c47" }, "downloads": -1, "filename": "trollius_redis-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d590c9b594cf2ddadddb77abdcb74653", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 35749, "upload_time": "2015-04-16T18:57:17", "url": "https://files.pythonhosted.org/packages/71/29/5f04964991fbca0b048b784e5eaa99cb21c19e00019e412e2da40a6f1e1f/trollius_redis-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06d2803e955bd1793b9d0d9e0a7ff924", "sha256": "c5282523c90c5334f9c5cf13ad0b2487c6a2d44e51cf153e9b4bf7dcdd49caa4" }, "downloads": -1, "filename": "trollius_redis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "06d2803e955bd1793b9d0d9e0a7ff924", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32017, "upload_time": "2015-04-16T18:57:06", "url": "https://files.pythonhosted.org/packages/be/6e/2191434e6a8b943709d1b48564171408a6580f5ae4c1f8a689e21b6ab4b1/trollius_redis-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d55179dc894d4d741d0c38515695f027", "sha256": "07ada0cec182cf33678d8e0d7297cf071ac1a4837a2a05b5e061fa4c01ce2d0c" }, "downloads": -1, "filename": "trollius_redis-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d55179dc894d4d741d0c38515695f027", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 35753, "upload_time": "2015-04-16T19:03:32", "url": "https://files.pythonhosted.org/packages/e1/7e/b20d219c88d06da6934f2324207fe1ce7e2744422da7411b9cd548a05983/trollius_redis-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc66007be05e5dffaade6984bd1317cb", "sha256": "3e837964e7150f111c6bbb9d1884965f443684eb99f79b3814f7f7fb7a6da619" }, "downloads": -1, "filename": "trollius_redis-0.1.2.tar.gz", "has_sig": false, "md5_digest": "dc66007be05e5dffaade6984bd1317cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32029, "upload_time": "2015-04-16T19:03:29", "url": "https://files.pythonhosted.org/packages/78/02/ac77eca20a323a0ea2422270c1a95f15532733a2345b89d4eb74eb8625a5/trollius_redis-0.1.2.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "b677183ab7b82482d7d4aa69e0b11f5c", "sha256": "be382570abc71d6bec34148521bb63a430fa66b7d71f2c7c49dc5aaabc7dd32d" }, "downloads": -1, "filename": "trollius_redis-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b677183ab7b82482d7d4aa69e0b11f5c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 35873, "upload_time": "2015-04-20T23:26:34", "url": "https://files.pythonhosted.org/packages/16/f2/196357dc53eb212a8e45ee996ccf80302506f68026a1c0585f8f310fed90/trollius_redis-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3c48961e733fd0cc7185243b0a8ddae", "sha256": "dea58cd72ccfd0aecb6d0f4566ae695fc074eadb4cf7c4df8daabefaf5f57b4c" }, "downloads": -1, "filename": "trollius_redis-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d3c48961e733fd0cc7185243b0a8ddae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32125, "upload_time": "2015-04-20T23:26:31", "url": "https://files.pythonhosted.org/packages/3a/f8/a29a1956191faf6b55880dd1a584174735ff250adc655bb11dd759b13220/trollius_redis-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b677183ab7b82482d7d4aa69e0b11f5c", "sha256": "be382570abc71d6bec34148521bb63a430fa66b7d71f2c7c49dc5aaabc7dd32d" }, "downloads": -1, "filename": "trollius_redis-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b677183ab7b82482d7d4aa69e0b11f5c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 35873, "upload_time": "2015-04-20T23:26:34", "url": "https://files.pythonhosted.org/packages/16/f2/196357dc53eb212a8e45ee996ccf80302506f68026a1c0585f8f310fed90/trollius_redis-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3c48961e733fd0cc7185243b0a8ddae", "sha256": "dea58cd72ccfd0aecb6d0f4566ae695fc074eadb4cf7c4df8daabefaf5f57b4c" }, "downloads": -1, "filename": "trollius_redis-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d3c48961e733fd0cc7185243b0a8ddae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32125, "upload_time": "2015-04-20T23:26:31", "url": "https://files.pythonhosted.org/packages/3a/f8/a29a1956191faf6b55880dd1a584174735ff250adc655bb11dd759b13220/trollius_redis-0.1.4.tar.gz" } ] }