Redis Semaphore Async is a Python library that provides an asynchronous semaphore implementation using Redis as the backend.
Project description
Redis-Semaphore-Async
Redis-Semaphore-Async is a Python library that provides an asynchronous semaphore implementation using Redis as the backend. It allows you to manage concurrent access to resources in a distributed environment.
Installation
To install Redis-Semaphore-Async, you can use pip:
pip install redis-semaphore-async
Usage
Here is an example of how to use Redis-Semaphore-Async:
import asyncio
from redis.asyncio import Redis
from redis_semaphore_async import Semaphore
async def main():
redis = Redis(host='localhost', port=6379, decode_responses=True)
async with Semaphore(redis=redis, task_name="test_semaphore", value=5):
# Your code here
pass
# or
semaphore = Semaphore(redis=redis, task_name="test_semaphore", value=5)
with semaphore:
# Your code here
pass
# or
semaphore = Semaphore(redis=redis, task_name="test_semaphore", value=5)
await semaphore.acquire()
# Your code here
await semaphore.release()
if __name__ == "__main__":
asyncio.run(main())
Contributing
We welcome contributions! Please read our contributing guidelines for more information.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis_semaphore_async-0.0.4.tar.gz.
File metadata
- Download URL: redis_semaphore_async-0.0.4.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
118dbf65b53a18b8f2919cc7629d5bc6c239ff42f6417917933c744764dc45ad
|
|
| MD5 |
260b064cc0c0c45e6f0ee47aaed95221
|
|
| BLAKE2b-256 |
e2579847be969b92cc3417801864e9bd4ee88a47c3d37160c8ef8b8ee86e245f
|
File details
Details for the file redis_semaphore_async-0.0.4-py3-none-any.whl.
File metadata
- Download URL: redis_semaphore_async-0.0.4-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae1557a7e54286b4ff1e569ef9b4ad2ffa3501d2ff4f42f8e4dbd8070972d3ce
|
|
| MD5 |
0189fb9cc1fe20882989b50241cb5273
|
|
| BLAKE2b-256 |
b7f956805424e88d11ab2bc7cc26c07077b0bcdf07e75ee1c79e4edcf67fbb58
|