{ "info": { "author": "Egor Malykh", "author_email": "emalykh@okko.tv", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# Redis cluster distributed lock\nDistributed lock that works on top of the Redis cluster or single node\n\n## Installation\n```bash\npip install redis_cluster_lock\n```\n\n## Usage\n\nSimple usage with single redis node:\n```python\nfrom redis_cluster_lock import SimpleLock\nfrom redis import StrictRedis\n\nredis_client = StrictRedis(...)\n\nwith SimpleLock(redis_client, 'lock:name'):\n print('Locked code here')\n```\n\nSimple usage with redis cluster:\n```python\nfrom redis_cluster_lock import SimpleLock\nfrom rediscluster import StrictRedisCluster\n\nredis_client = StrictRedisCluster(...)\n\nwith SimpleLock(redis_client, 'lock:name'):\n print('Locked code here')\n```\n\nAdvanced usage:\n```python\nfrom redis_cluster_lock import SimpleLock\nfrom redis_cluster_lock.error import NotAcquired\nfrom redis import StrictRedis\n\nredis_client = StrictRedis(...)\n\nlock = SimpleLock(\n redis_client=redis_client,\n key='lock:name',\n blocking=True,\n timeout=60,\n # lock will be auto-renewed while SimpleLock object is alive\n # use any positive integer to set expiring lock\n expire=0\n)\n\n# will be blocked for 60 seconds\nif not lock.acquire():\n print('Can not acquire lock')\n exit()\n\nprint('Locked code here')\n\ntry:\n # use strict=False to avoid rising exception\n lock.release(strict=True)\nexcept NotAcquired:\n print('Lock was not acquired')\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/okkotv/redis-cluster-lock", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "redis-cluster-lock", "package_url": "https://pypi.org/project/redis-cluster-lock/", "platform": "", "project_url": "https://pypi.org/project/redis-cluster-lock/", "project_urls": { "Homepage": "https://github.com/okkotv/redis-cluster-lock" }, "release_url": "https://pypi.org/project/redis-cluster-lock/0.1.1/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "Distributed lock that works on top of the Redis cluster or single node.", "version": "0.1.1" }, "last_serial": 5426713, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "573e0bbfa88a3adb3f0e844830e2ab26", "sha256": "19855bc2076e36465a9bd95e91372af4e80bc33cd14dfefec766585b9398eb87" }, "downloads": -1, "filename": "redis_cluster_lock-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "573e0bbfa88a3adb3f0e844830e2ab26", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 4904, "upload_time": "2019-06-20T16:42:30", "url": "https://files.pythonhosted.org/packages/08/cf/2c454cda3388a2330daae3c7c781369774ddc9b87345c22f47bd951aac1f/redis_cluster_lock-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0fb7b6bb286571ad32b0f7d6c910110f", "sha256": "12ccf1def98829e288ee371046a4bdf48a1aed5849981ebb3203a550c609b3de" }, "downloads": -1, "filename": "redis-cluster-lock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0fb7b6bb286571ad32b0f7d6c910110f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4553, "upload_time": "2019-06-20T16:42:32", "url": "https://files.pythonhosted.org/packages/65/3a/561aa09d85bea878c3fa6b9b53ef0ca74944d6692c9195f30f3e96762a2d/redis-cluster-lock-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "573e0bbfa88a3adb3f0e844830e2ab26", "sha256": "19855bc2076e36465a9bd95e91372af4e80bc33cd14dfefec766585b9398eb87" }, "downloads": -1, "filename": "redis_cluster_lock-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "573e0bbfa88a3adb3f0e844830e2ab26", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 4904, "upload_time": "2019-06-20T16:42:30", "url": "https://files.pythonhosted.org/packages/08/cf/2c454cda3388a2330daae3c7c781369774ddc9b87345c22f47bd951aac1f/redis_cluster_lock-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0fb7b6bb286571ad32b0f7d6c910110f", "sha256": "12ccf1def98829e288ee371046a4bdf48a1aed5849981ebb3203a550c609b3de" }, "downloads": -1, "filename": "redis-cluster-lock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0fb7b6bb286571ad32b0f7d6c910110f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4553, "upload_time": "2019-06-20T16:42:32", "url": "https://files.pythonhosted.org/packages/65/3a/561aa09d85bea878c3fa6b9b53ef0ca74944d6692c9195f30f3e96762a2d/redis-cluster-lock-0.1.1.tar.gz" } ] }