{ "info": { "author": "Stephen McDonald", "author_email": "steve@jupo.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: POSIX", "Programming Language :: Python", "Topic :: Software Development :: Object Brokering", "Topic :: System :: Distributed Computing" ], "description": ".. image:: https://secure.travis-ci.org/stephenmcd/hot-redis.png?branch=master\n :target: http://travis-ci.org/stephenmcd/hot-redis\n\nCreated by `Stephen McDonald `_\n\nIntroduction\n============\n\nHOT Redis is a wrapper library for the `redis-py`_ client. Rather than\ncalling the `Redis`_ commands directly from a client library, HOT Redis\nprovides a wide range of data types that mimic many of the built-in\ndata types provided by Python, such as lists, dicts, sets, and more, as\nwell as many of the classes found throughout the standard library, such\nas those found in the Queue, threading, and collections modules.\n\nThese types are then backed by Redis, allowing objects to be\nmanipulated atomically over the network - the atomic nature of the\nmethods implemented on objects in HOT Redis is one of its core\nfeatures, and many of these are backed by `Lua`_ code executed within\nRedis, which ensures atomic operations where applicable.\n\nThe name HOT Redis originally stood for \"Higher Order Types for Redis\",\nbut since the implementation doesn't strictly fit the definition, the\nrecursive acronym \"HOT Object Toolkit for Redis\" should appease the\nmost luscious of bearded necks.\n\nHOT Redis was drawn from the infrastructure behind the\n`Kouio RSS reader`_, a popular alternative to Google Reader.\n\n\nInstallation\n============\n\nThe easiest way to install ``hot-redis`` is directly\nfrom PyPi using `pip`_ by running the following command::\n\n $ pip install -U hot-redis\n\nOtherwise you can download and install it directly from source::\n\n $ python setup.py install\n\n\nUsage\n=====\n\nEach of the types provided by HOT Redis strive to implement the same\nmethod signatures and return values as their Python built-in and\nstandard library counterparts. The main difference is each type's\n``__init__`` method. Every HOT Redis type's ``__init__`` method will\noptionally accept ``initial`` and ``key`` keyword arguments, which are\nused for defining an initial value to be stored in Redis for the\nobject, and the key that should be used, respectively. If no key is\nprovided, a key will be generated, which can then be accessed via the\n``key`` attribute::\n\n >>> from hot_redis import List\n >>> my_list = List()\n >>> my_list.key\n '93366bdb-90b2-4226-a52a-556f678af40e'\n >>> my_list_with_key = List(key=\"foo\")\n >>> my_list_with_key.key\n 'foo'\n\nOnce you've determined a strategy for naming keys, you can then create\nHOT Redis objects and interact with them over the network, for example\nhere is a ``List`` created on a computer we'll refer to as computer A::\n\n >>> list_on_computer_a = List(key=\"foo\", initial=[\"a\", \"b\", \"c\"])\n\nthen on another computer we'll creatively refer to as computer B::\n\n >>> list_on_computer_b = List(key=\"foo\")\n >>> list_on_computer_b[:] # Performs: LRANGE foo 0 -1\n ['a', 'b', 'c']\n >>> list_on_computer_b += ['d', 'e', 'f'] # Performs: RPUSH foo d e f\n\nand back to computer A::\n\n >>> list_on_computer_a[:] # Performs: LRANGE foo 0 -1\n ['a', 'b', 'c', 'd', 'e', 'f']\n >>> 'c' in list_on_computer_a # Works like Python lists where expected\n True\n >>> list_on_computer_a.reverse()\n >>> list_on_computer_a[:]\n ['f', 'e', 'd', 'c', 'b', 'a']\n\nThe last interaction here is an interesting one. Python's\n``list.reverse()`` is an in-place reversal of the list, that is, it\nmodifies the existing list, rather than returning a reversed copy. If\nwe were to implement this naively, we would first read the list from\nRedis, reverse it locally, then store the reversed list back in Redis\nagain. But what if another client were to modify the list at\napproximately the same time? One computer's modification to the list\nwould certainly overwrite the other's. In this scenario, and *many*\nothers, HOT Redis provides its own Lua routine specifically for\nreversing the list in-place, within Redis atomically. I wrote in more\ndetail about this in a blog post, `Bitwise Lua Operations in Redis`_.\n\n\nConfiguration\n=============\n\nBy default, HOT Redis attempts to connect to a Redis instance running\nlocally on the default port 6379. You can configure the default client\nby calling the ``hot_redis.configure`` function, prior to instantiating\nany HOT Redis objects. The arguments given to ``configure`` are passed\nonto the underlying `redis-py`_ client::\n\n >>> from hot_redis import configure\n configure(host='myremotehost', port=6380)\n\nAlternatively, if you wish to use a different client per object, you\ncan explicitly create a ``HotClient`` instance, and pass it to each\nobject::\n\n >>> from hot_redis import HotClient, Queue\n >>> client = HotClient(host=\"myremotehost\", port=6380)\n >>> my_queue = Queue(client=client)\n\n\nTransactions\n============\n\nBasic support for thread-safe transactions are provided using the\nRedis ``MULTI`` and ``EXEC`` commands::\n\n >>> from hot_redis import List, Queue, transaction\n >>> my_list = List(key=\"foo\")\n >>> my_queue = Queue(key=\"bar\")\n >>> with transaction():\n ... for i in range(20):\n ... my_list.append(i)\n ... my_queue.put(i)\n\nIn the above example, all of the ``append`` and ``put`` calls are\nbatched together into a single transaction, that is executed once the\n``transaction()`` context is exited.\n\n\nData Types\n==========\n\nThe following table is the complete list of types provided by HOT\nRedis, mapped to their Python counterparts and underlying Redis types,\nalong with any special considerations worth noting.\n\n================== ============================ ========== ===============\nHOT Redis Python Redis Notes\n================== ============================ ========== ===============\nList list list\nSet set set\nDict dict hash\nString string string Mutable - string methods that normally create a new string object in Python will mutate the string stored in Redis\nImmutableString string string Immutable - behaves like a regular Python string\nInt int int\nFloat float float\nQueue Queue.Queue list\nLifoQueue Queue.LifoQueue list\nSetQueue N/A list + set Extension of ``Queue`` with unique members\nLifoSetQueue N/A list + set Extension of ``LifoQueue`` with unique members\nBoundedSemaphore threading.BoundedSemaphore list Extension of ``Queue`` leveraging Redis' blocking list pop operations with timeouts, while using Queue's ``maxsize`` arg to provide BoundedSemaphore's ``value`` arg\nSemaphore threading.Semaphore list Extension of ``BoundedSemaphore`` without a queue size\nLock threading.Lock list Extension of ``BoundedSemaphore`` with a queue size of 1\nRLock threading.RLock list Extension of ``Lock`` allowing multiple ``acquire`` calls\nDefaultDict collections.DefaultDict hash\nMultiSet collections.Counter hash\n================== ============================ ========== ===============\n\n.. _`redis-py`: https://github.com/andymccurdy/redis-py\n.. _`Redis`: http://redis.io\n.. _`Lua`: http://www.lua.org/\n.. _`Kouio RSS reader`: https://kouio.com\n.. _`pip`: http://www.pip-installer.org/\n.. _`Bitwise Lua Operations in Redis`: http://blog.jupo.org/2013/06/12/bitwise-lua-operations-in-redis/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/stephenmcd/hot-redis", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "hot-redis", "package_url": "https://pypi.org/project/hot-redis/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hot-redis/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/stephenmcd/hot-redis" }, "release_url": "https://pypi.org/project/hot-redis/0.3/", "requires_dist": null, "requires_python": null, "summary": "Higher Order Types for Redis", "version": "0.3" }, "last_serial": 1462205, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "95c678c0b64049e965565cda6afc45bc", "sha256": "890d2acbfa39ce9eae95cbdfa2e4c494c2b63133b14c53a11de30c33f02e307c" }, "downloads": -1, "filename": "hot-redis-0.1.0.tar.gz", "has_sig": false, "md5_digest": "95c678c0b64049e965565cda6afc45bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15709, "upload_time": "2013-10-24T10:31:44", "url": "https://files.pythonhosted.org/packages/73/05/3438bf56be82e4ce3ef7a0abb9327566b6cc0f146d36904e537d54d52264/hot-redis-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ccab8d0a94de6d4125853d797e5de4b6", "sha256": "565e3963f732546f9d7c7dc42cc5c74bd2e80e51ae0477338bc6887f116f0f64" }, "downloads": -1, "filename": "hot-redis-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ccab8d0a94de6d4125853d797e5de4b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16225, "upload_time": "2014-03-11T20:14:06", "url": "https://files.pythonhosted.org/packages/64/c1/b3311a968077881ea2cd2a2a465e42e164db0f799ccb8db495e51ba6d550/hot-redis-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a44cce705a05dba1229e5eea3c7c869d", "sha256": "9969586e9d3e1f4509a5f9aae2f096c1f3e279273abeb29ecef7497f76b38992" }, "downloads": -1, "filename": "hot_redis-0.2.1-py27-none-any.whl", "has_sig": false, "md5_digest": "a44cce705a05dba1229e5eea3c7c869d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20365, "upload_time": "2014-06-09T05:29:55", "url": "https://files.pythonhosted.org/packages/fc/42/f295eb48b670bdb03b847022e9092b370b034960e80ba0bf763045090d1f/hot_redis-0.2.1-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "700dba3c949da2e93f6a5e9bd65d6b70", "sha256": "db800a09a964317c4a4ceb7dfbe640aa1878375bc9b2c4ef7c61b05a2afe42c1" }, "downloads": -1, "filename": "hot-redis-0.2.1.tar.gz", "has_sig": false, "md5_digest": "700dba3c949da2e93f6a5e9bd65d6b70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16914, "upload_time": "2014-06-09T05:29:51", "url": "https://files.pythonhosted.org/packages/7c/07/cc59ad830438c1112f5c61f2674404429da4a64c08bd81fc3848d0e77102/hot-redis-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "7e70a81da91489fed5f56bb136646cb5", "sha256": "5396e4e048f9904f594a3fab5be4a9b069f7997c086c51476ba776d834790a8f" }, "downloads": -1, "filename": "hot_redis-0.2.2-py27-none-any.whl", "has_sig": false, "md5_digest": "7e70a81da91489fed5f56bb136646cb5", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20503, "upload_time": "2014-07-08T22:50:54", "url": "https://files.pythonhosted.org/packages/56/b2/000882a295e5924b952357b9627e4ab2f700818ca762d6e49cec765bfe33/hot_redis-0.2.2-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecc036f0f18b0badce2744cb16039bf2", "sha256": "e6e935f4e1e9c70ea325887edea8d7475abfc814a9530954e66e1c2db3e3d3d3" }, "downloads": -1, "filename": "hot-redis-0.2.2.tar.gz", "has_sig": false, "md5_digest": "ecc036f0f18b0badce2744cb16039bf2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17023, "upload_time": "2014-07-08T22:50:50", "url": "https://files.pythonhosted.org/packages/64/43/fa7a420c94f62bd74e3a20ca2c43cfc0af73f0b814d4e7181cf2de4a5369/hot-redis-0.2.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "384f65f6ea257260088d05e2645c6137", "sha256": "15472a0f243035996a254b410d76605367b676282c7292856cb842caf4e81dfc" }, "downloads": -1, "filename": "hot_redis-0.3-py27-none-any.whl", "has_sig": false, "md5_digest": "384f65f6ea257260088d05e2645c6137", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20964, "upload_time": "2015-03-16T02:07:12", "url": "https://files.pythonhosted.org/packages/5c/bc/9e94da7eed6b536995da28eb758df2cd9c664e19b8998ce5a7fc21c14494/hot_redis-0.3-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66772e4c6556b349396973ffd3fc4393", "sha256": "b22cb778f8db0ea95f001ba5935635136be3f86f298d4830d5c5a9e785929ed8" }, "downloads": -1, "filename": "hot-redis-0.3.tar.gz", "has_sig": false, "md5_digest": "66772e4c6556b349396973ffd3fc4393", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17526, "upload_time": "2015-03-16T02:07:08", "url": "https://files.pythonhosted.org/packages/bc/50/7eb661c88b22e91587937a2496a69e6d9e31d561afb5c95090199722fd0c/hot-redis-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "384f65f6ea257260088d05e2645c6137", "sha256": "15472a0f243035996a254b410d76605367b676282c7292856cb842caf4e81dfc" }, "downloads": -1, "filename": "hot_redis-0.3-py27-none-any.whl", "has_sig": false, "md5_digest": "384f65f6ea257260088d05e2645c6137", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 20964, "upload_time": "2015-03-16T02:07:12", "url": "https://files.pythonhosted.org/packages/5c/bc/9e94da7eed6b536995da28eb758df2cd9c664e19b8998ce5a7fc21c14494/hot_redis-0.3-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66772e4c6556b349396973ffd3fc4393", "sha256": "b22cb778f8db0ea95f001ba5935635136be3f86f298d4830d5c5a9e785929ed8" }, "downloads": -1, "filename": "hot-redis-0.3.tar.gz", "has_sig": false, "md5_digest": "66772e4c6556b349396973ffd3fc4393", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17526, "upload_time": "2015-03-16T02:07:08", "url": "https://files.pythonhosted.org/packages/bc/50/7eb661c88b22e91587937a2496a69e6d9e31d561afb5c95090199722fd0c/hot-redis-0.3.tar.gz" } ] }