{ "info": { "author": "Richard Mathie", "author_email": "richard.mathie@cantab.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "Redis PubSub Dict\n=================\n\n|PyPI version|\n\nA python class for using redis, or other key value stores, as a\ndictionary and caching the values locally for read heavy workloads.\nHeavily inspired by `pylru `__.\n\nUsage\n-----\n\nThe idea is that Deleting or Updating keys in an instance of\n``PubSubRedisDict`` or ``PubSubCacheManager`` will update the matching\ncached keys in all instances of ``PubSubCacheManager``.\n``PubSubCacheManager`` will therefor maintain a cache of recently used\nkeys using an ``lru`` or just a straight up ``dict()``. This will reduce\nthe round trip latency and network overhead for any reads of the cached\nkeys.\n\n``RedisDict`` and ``RedisDict`` should work with instances of\n``redis.StrictRedis`` or ``rediscluster.StrictRedisCluster``. Use the\n``prefix`` for managing redis key namespaces.\n\nRedisDict\n~~~~~~~~~\n\nJust like a normal dictionary, but networked. Initialisation wont take a\ndictionary or iterable for now as it need connection and namespace\ninformation.\n\n.. code:: python\n\n rc = StrictRedisCluster(startup_nodes=[{\"host\": \"redis\", \"port\": \"6379\"}])\n reddict = RedisDict(rc, 'namespace')\n\n # you can set\n reddict[1] = 1\n reddict[2] = [1,2,3]\n reddict['hello'] = 'world'\n reddict[('complex',1)] = {'I': {'Am': {'Quite': ['a', 'complex', {'object': {} }]}}}\n\n # get somewhere else\n reddict[1]\n reddict['1'] # note its the same as reddict[1]\n reddict[('complex',1)]\n reddict[\"('complex', 1)\"] # the key is str(('complex',1))\n\n # delete\n del reddict[1]\n # .. ect\n\nPubSubRedisDict\n~~~~~~~~~~~~~~~\n\nLike ``RedisDict`` but will publish key update and delete events to a\n``/[update|delete]`` channel.\n\n.. code:: python\n\n redpubsub = PubSubRedisDict(rc, 'namespace')\n # ect as before\n\nPubSubCacheManager\n~~~~~~~~~~~~~~~~~~\n\nLike ``pylry.WriteThroughCacheManager`` but updates cache keys from\nstore when it receives a message from the\n``/[update|delete]`` channel.\n\n.. code:: python\n\n cache = pylru.lrucache(10) # maybe more than 10\n redstore = PubSubRedisDict(rc, 'namespace')\n redcache = PubSubCacheManager(redstore, cache)\n # ect as before\n # see the cache\n print dict(redcache.cache)\n\nFurther uses\n~~~~~~~~~~~~\n\nYou can hook up ``RedisDict`` or ``PubSubRedisDict`` to\n``pylru.WriteBackCacheManager`` to get a Redis backed dictionary which\nonly writes to Redis on 'flush' or when the item pops off the ``lru``\nfor write intensive workloads. However a lot more work would need to be\ndone to add the pubsub mechanism as there difficult cases to consider,\nsuch as what happens when the cache is dirty and we get notified that\nthe store key is updated?\n\nLimitations\n-----------\n\n- all keys are strings.\n- ``msgpack`` is used to marshal objects to redis, so ``msgpack``\n object limitations apply. Though you can monkey patch the modules\n ``loads`` and ``dumps`` method if you like.\n- publish will publish to all consuming dictionary instances, there is\n no partitioning, so writes and updates are expensive. You could come\n up with a partitioning strategy to improve this.\n- The published items eventually end up in the watched cash. There may\n be a time lag between a client publishing a change and the key\n updating in another clients cache.\n\nReferences\n----------\n\n- `redis-py `__\n- `redis-py-cluster `__\n- `pylru `__\n\n.. |PyPI version| image:: https://img.shields.io/pypi/v/redis-pubsub-dict.svg\n :target: https://pypi.python.org/pypi/redis-pubsub-dict", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Richard-Mathie/py-redis-pubsub-dict", "keywords": "", "license": "GNU GPLv2", "maintainer": "", "maintainer_email": "", "name": "redis-pubsub-dict", "package_url": "https://pypi.org/project/redis-pubsub-dict/", "platform": "any", "project_url": "https://pypi.org/project/redis-pubsub-dict/", "project_urls": { "Homepage": "https://github.com/Richard-Mathie/py-redis-pubsub-dict" }, "release_url": "https://pypi.org/project/redis-pubsub-dict/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A python class for using redis, or other key value stores, and caching the values for read heavy workloads", "version": "0.0.2" }, "last_serial": 3484393, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1310200c213b339593e998258f0af63e", "sha256": "a2d21a6f514807e6bf4437a778217f6f17c2937a2734250839f68ce827cabc4a" }, "downloads": -1, "filename": "redis_pubsub_dict-0.0.1.tar.gz", "has_sig": false, "md5_digest": "1310200c213b339593e998258f0af63e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4764, "upload_time": "2018-01-11T19:18:47", "url": "https://files.pythonhosted.org/packages/d4/f2/f8c032602de6c40bf1eff8cff1cdfba6eb15dfe3ab66660ed769ac9e4e1b/redis_pubsub_dict-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "762c421363b9852d58d9e8d66ce1c982", "sha256": "7229c21e8cb12838d66bc923dffdd54e15f009b0b8816f5ab7564b5d93b664c9" }, "downloads": -1, "filename": "redis_pubsub_dict-0.0.2.tar.gz", "has_sig": false, "md5_digest": "762c421363b9852d58d9e8d66ce1c982", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4934, "upload_time": "2018-01-12T14:52:29", "url": "https://files.pythonhosted.org/packages/f9/27/369fd6f17c42b30443b32f57365ec4bc6463d00cf8abdb52aae49690eb9d/redis_pubsub_dict-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "762c421363b9852d58d9e8d66ce1c982", "sha256": "7229c21e8cb12838d66bc923dffdd54e15f009b0b8816f5ab7564b5d93b664c9" }, "downloads": -1, "filename": "redis_pubsub_dict-0.0.2.tar.gz", "has_sig": false, "md5_digest": "762c421363b9852d58d9e8d66ce1c982", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4934, "upload_time": "2018-01-12T14:52:29", "url": "https://files.pythonhosted.org/packages/f9/27/369fd6f17c42b30443b32f57365ec4bc6463d00cf8abdb52aae49690eb9d/redis_pubsub_dict-0.0.2.tar.gz" } ] }