{ "info": { "author": "Tudor Aursulesei", "author_email": "thestick613@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "========\nOverview\n========\n\n\n\nA distributed redis cache library, which solves the Thundering Herd problem.\n\n* Free software: BSD license\n\nInstallation\n============\n\n::\n\n pip install thundercache\n\nDocumentation\n=============\n\nhttps://python-thundercache.readthedocs.io/\n\nDevelopment\n===========\n\nTo run the all tests run::\n\n tox\n\nNote, to combine the coverage data from all the tox environments run:\n\n.. list-table::\n :widths: 10 90\n :stub-columns: 1\n\n - - Windows\n - ::\n\n set PYTEST_ADDOPTS=--cov-append\n tox\n\n - - Other\n - ::\n\n PYTEST_ADDOPTS=--cov-append tox\n\nUsage\n=====\n\n.. code-block:: python\n\n # Distributed Lock\n from thundercache import LockFactory, retry_command\n from redis.sentinel import Sentinel\n\n sentinel = Sentinel()\n redis_sentinel_master_instance = retry_command(sentinel.master_for, \"your_sentinel_service_name\", socket_timeout=20)\n\n locks = LockFactory(expires=720, timeout=10, redis=redis_sentinel_master_instance)\n\n with locks('my_lock'):\n # do stuff with a distributed redis lock across different processes and networks\n # pretty cool right!\n pass\n\n\n # Local Redis Cache\n from thundercache import SmartLocalRedisCacheFactory, BaseCacheMixin)\n import time\n\n lcached = SmartLocalRedisCacheFactory()\n\n\n class MyClass(BaseCacheMixin):\n\n @lcached(\"method\", max_age=10, critical=2)\n def method(self, n):\n time.sleep(n)\n return n*n\n\n @lcached(\"somefunc', max_age=10, critical=2)\n def somefunc(n):\n time.sleep(n)\n return n*n\n\n\n mc = MyClass()\n print mc.method(3)\n # prints \"9\" after three seconds\n print mc.method(3)\n # prints \"9\" instantly\n\n print somefunc(2)\n # prints \"4\" after two seconds\n print somefunc(2)\n # prints 4\n\n\n\n # Distributed Redis Cache\n from thundercache import SmartRedisCacheFactory, retry_command\n from redis.sentinel import Sentinel\n\n sentinel = Sentinel()\n cached = SmartRedisCacheFactory(sentinel, \"your_sentinel_service_name\")\n # you can now use the @cached decorator in the same way you use @lcached\n\n\n\n # Per process cache\n from thundercache import BaseCache\n\n class MyClass(BaseCacheMixin):\n @BaseCache(\"mymethod\", max_age=10)\n def mymethod(self, n):\n time.sleep(n)\n return n*n\n\n @BaseCache(\"otherfunc', max_age=10)\n def otherfunc(n):\n time.sleep(n)\n return n*n\n\n\n # You can also chain these decorators\n @BaseCache('x', 10)\n @cached('y', 60)\n def funct_or_method(*args, **kwargs):\n return None\n\n::\n\n\nChangelog\n=========\n\n0.1.2 (2017-02-23)\n-----------------------------------------\n\n* First release on PyPI.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/thestick613/python-thundercache", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "thundercache", "package_url": "https://pypi.org/project/thundercache/", "platform": "", "project_url": "https://pypi.org/project/thundercache/", "project_urls": { "Homepage": "https://github.com/thestick613/python-thundercache" }, "release_url": "https://pypi.org/project/thundercache/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A distributed redis cache library, which solves the Thundering Herd problem.", "version": "0.1.2" }, "last_serial": 2663029, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "4688ce2a5531f1298c571249ed5172b5", "sha256": "0da9e27e10c7143961bfe6e59269459e9b8daa577a013c63cfb2bc807414fdee" }, "downloads": -1, "filename": "thundercache-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4688ce2a5531f1298c571249ed5172b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12485, "upload_time": "2017-02-23T11:17:20", "url": "https://files.pythonhosted.org/packages/36/fe/162c458ea3c91a0a6beb3f1027256d61e59cdbfb0e0e972521e22a1b1009/thundercache-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4688ce2a5531f1298c571249ed5172b5", "sha256": "0da9e27e10c7143961bfe6e59269459e9b8daa577a013c63cfb2bc807414fdee" }, "downloads": -1, "filename": "thundercache-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4688ce2a5531f1298c571249ed5172b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12485, "upload_time": "2017-02-23T11:17:20", "url": "https://files.pythonhosted.org/packages/36/fe/162c458ea3c91a0a6beb3f1027256d61e59cdbfb0e0e972521e22a1b1009/thundercache-0.1.2.tar.gz" } ] }