{"id":18004768,"url":"https://github.com/goodmanwen/aioredlock-py","last_synced_at":"2026-06-15T20:31:34.834Z","repository":{"id":128813002,"uuid":"482006303","full_name":"GoodManWEN/aioredlock-py","owner":"GoodManWEN","description":"Secure and efficient distributed locks (Radisson like) implemetation","archived":false,"fork":false,"pushed_at":"2022-04-16T19:13:17.000Z","size":92,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-24T12:52:09.111Z","etag":null,"topics":["asyncio","redis","redisson","redlock"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoodManWEN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-15T15:44:00.000Z","updated_at":"2023-02-11T12:48:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"69547be0-1a40-4505-bb85-60a256bf870e","html_url":"https://github.com/GoodManWEN/aioredlock-py","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GoodManWEN/aioredlock-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodManWEN%2Faioredlock-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodManWEN%2Faioredlock-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodManWEN%2Faioredlock-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodManWEN%2Faioredlock-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodManWEN","download_url":"https://codeload.github.com/GoodManWEN/aioredlock-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodManWEN%2Faioredlock-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34379915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","redis","redisson","redlock"],"created_at":"2024-10-30T00:15:56.804Z","updated_at":"2026-06-15T20:31:34.817Z","avatar_url":"https://github.com/GoodManWEN.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aioredlock-py\n[![fury](https://img.shields.io/pypi/v/aioredlock-py.svg)](https://pypi.org/project/aioredlock-py/)\n[![licence](https://img.shields.io/github/license/GoodManWEN/aioredlock-py)](https://github.com/GoodManWEN/aioredlock-py/blob/master/LICENSE)\n[![pyversions](https://img.shields.io/pypi/pyversions/aioredlock-py.svg)](https://pypi.org/project/aioredlock-py/)\n[![Publish](https://github.com/GoodManWEN/aioredlock-py/workflows/Publish/badge.svg)](https://github.com/GoodManWEN/aioredlock-py/actions?query=workflow:Publish)\n[![Build](https://github.com/GoodManWEN/aioredlock-py/workflows/Build/badge.svg)](https://github.com/GoodManWEN/aioredlock-py/actions?query=workflow:Build)\n[![Docs](https://readthedocs.org/projects/aioredlock-py/badge/?version=latest)](https://readthedocs.org/projects/aioredlock-py/)\n\nSecure and efficient distributed locks (Redisson like) implemetation. Ensure efficient performance with biased locking's implementation, can load more than 1k/s of concurrent requests with default parameter settings.\n\n## Requirements\n- aioredis\u003e=2.0.0\n\n## Install\n\n    pip install aioredlock-py\n\n## Feature\n- Ensure reliability with context manager.\n- Use lua scripts to ensure atomicity on lock release.\n- Notification prompt you to cancel the following execution if acquisition fails\n- Reliable in high concurrency.\n\n## Documentation\nhttps://aioredlock-py.readthedocs.io\n\n## Basic usage\n```python\nimport asyncio\nimport aioredis\nfrom aioredlock_py import Redisson\n\nasync def single_thread(redis):\n    for _ in range(10):\n        async with Redisson(redis, key=\"no1\") as lock:\n            if not lock:\n                # If the lock still fails after several attempts, `__aenter__` \n                # will return None to prompt you to cancel the following execution\n                return 'Do something, failed to acquire lock' # raise ...\n            # else \n            # Service logic protected by Redisson\n            await redis.incr(\"foo\")\n\nasync def test_long_term_occupancy(redis):\n    async with Redisson(redis, key=\"no1\", ex=10) as lock:\n        if not lock: return;\n        # Service logic protected by Redisson\n        await redis.set(\"foo\", 0)\n        # By default, a lock is automatically released if no action is \n        # taken for 20 seconds after redisson holds it. Let's assume that \n        # your service logic takes a long time (30s in this case) to process,\n        # you don't need to worry about it causing chaos, because there's \n        # background threads help you automatically renew legally held locks.\n        await asyncio.sleep(30)\n        await redis.incr(\"foo\")\n\n\nasync def main():\n    redis = aioredis.from_url(\"redis://localhost\")\n    await redis.delete(\"redisson:no1\")\n    await redis.set(\"foo\", 0)\n    await asyncio.gather(*(single_thread(redis) for _ in range(20)))\n    assert int(await redis.get(\"foo\")) == 200\n    # await test_long_term_occupancy(redis)\n\nasyncio.run(main())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodmanwen%2Faioredlock-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodmanwen%2Faioredlock-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodmanwen%2Faioredlock-py/lists"}