# **Redis Manager**
[![PyPI version](https://img.shields.io/pypi/v/redis-manager.svg)](https://pypi.org/project/redis-manager/)
[![Python versions](https://img.shields.io/pypi/pyversions/redis-manager.svg)](https://pypi.org/project/redis-manager/)
[![License](https://img.shields.io/pypi/l/redis-manager.svg)](https://pypi.org/project/redis-manager/)
<img src="assets/logo.png" alt="Redis Manager Logo" width="200">
---
## **Features**
- **Asynchronous & High-Performance**: Non-blocking operations with `asyncio`.
- **Auto-Healing Connection Pools**: Recover from failures without service restarts.
- **Context Manager**: Prevent resource leaks in high-concurrency systems.
- **Real-Time Monitoring**: Prometheus metrics for insights and debugging.
- **Redis Cluster Support**: Simplified handling of distributed nodes.
[➡️ View All Features](docs/features.md)
---
## **Quickstart**
### Install Redis Manager:
```bash
pip install redis-manager
```
### Example Code:
```python
from redis_manager.redis_manager import RedisManager
async def main():
manager = RedisManager(connection_pools_per_node_at_start=2)
await manager.add_node_pool("redis://localhost")
manager.start_cleanup()
# Note: The RedisManager can be wrapped in a try/catch block to gracefully handle exceptions
# such as connection errors or unavailability of Redis nodes.
async with manager.get_client("redis://localhost") as client:
await client.set("key", "value")
value = await client.get("key")
print(value)
# Stop tasks and close pools
manager.stop_health_checks()
manager.stop_cleanup()
await manager.close_all_pools()
```
---
## **Architecture Diagram**
```mermaid
graph TD
subgraph RedisManager
A[Connection Pools] -->|Healthy Connections| B[Redis Nodes]
A -->|Health Check Task| C[Periodic Health Checks]
A -->|Cleanup Task| D[Idle Connection Cleanup]
end
B -->|Commands| E[Redis Server]
subgraph Monitoring
A -->|Metrics| F[Prometheus Exporter]
F --> G[Prometheus]
G --> H[Grafana Dashboard]
end
```
---
## **Documentation**
- [➡️ Learn More About Architecture](docs/architecture.md)
- [➡️ Why Redis Manager?](docs/why_redis_manager.md)
- [➡️ Usage Examples](docs/usage.md)
- [➡️ API Documentation](docs/REDIS_MANAGER_API_DOCS.md)
- [➡️ Packaging](docs/packaging.md)
---
## **Acknowledgments**
- **Redis**: The powerful in-memory data structure store used for fast data storage and retrieval.
- **Asyncio**: Python's asynchronous programming framework, enabling efficient and scalable async operations.
- **Bitnami Redis Cluster Docker Images**: Used in testing and integration for seamless containerized Redis cluster setups.
- **Prometheus**: Open-source monitoring and alerting toolkit for metrics collection and visualization.
- **Grafana**: The leading open-source analytics and interactive visualization tool, providing rich dashboards for monitoring Redis performance and related metrics.
---
## **Changelog**
Detailed changelog in [CHANGELOG.md](CHANGELOG.md).
---
## **License**
Licensed under the MIT License. See [LICENSE](LICENSE) file for more details.
---
## **Contributing**
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) to get started.
---
**Initially Developed by [Youssef Khaya](https://www.linkedin.com/in/youssef-khaya-88a1a128)**
Raw data
{
"_id": null,
"home_page": null,
"name": "redis-manager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "redis, connection pool, asyncio, manager, python",
"author": null,
"author_email": "yokha <khaya.youssef@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/76/8b/696609292055a6887bdab9f4b17bca811c80568415844169f518109bbdb3/redis_manager-0.1.1.tar.gz",
"platform": null,
"description": "\n# **Redis Manager**\n[![PyPI version](https://img.shields.io/pypi/v/redis-manager.svg)](https://pypi.org/project/redis-manager/) \n[![Python versions](https://img.shields.io/pypi/pyversions/redis-manager.svg)](https://pypi.org/project/redis-manager/) \n[![License](https://img.shields.io/pypi/l/redis-manager.svg)](https://pypi.org/project/redis-manager/)\n\n<img src=\"assets/logo.png\" alt=\"Redis Manager Logo\" width=\"200\">\n\n---\n\n## **Features**\n- **Asynchronous & High-Performance**: Non-blocking operations with `asyncio`.\n- **Auto-Healing Connection Pools**: Recover from failures without service restarts.\n- **Context Manager**: Prevent resource leaks in high-concurrency systems.\n- **Real-Time Monitoring**: Prometheus metrics for insights and debugging.\n- **Redis Cluster Support**: Simplified handling of distributed nodes.\n\n[\u27a1\ufe0f View All Features](docs/features.md)\n\n---\n\n## **Quickstart**\n\n### Install Redis Manager:\n```bash\npip install redis-manager\n```\n\n### Example Code:\n```python\nfrom redis_manager.redis_manager import RedisManager\n\nasync def main():\n manager = RedisManager(connection_pools_per_node_at_start=2)\n await manager.add_node_pool(\"redis://localhost\")\n manager.start_cleanup()\n\n # Note: The RedisManager can be wrapped in a try/catch block to gracefully handle exceptions\n # such as connection errors or unavailability of Redis nodes.\n async with manager.get_client(\"redis://localhost\") as client:\n await client.set(\"key\", \"value\")\n value = await client.get(\"key\")\n print(value)\n\n # Stop tasks and close pools\n manager.stop_health_checks()\n manager.stop_cleanup()\n await manager.close_all_pools()\n```\n\n---\n\n## **Architecture Diagram**\n\n```mermaid\ngraph TD\n subgraph RedisManager\n A[Connection Pools] -->|Healthy Connections| B[Redis Nodes]\n A -->|Health Check Task| C[Periodic Health Checks]\n A -->|Cleanup Task| D[Idle Connection Cleanup]\n end\n B -->|Commands| E[Redis Server]\n subgraph Monitoring\n A -->|Metrics| F[Prometheus Exporter]\n F --> G[Prometheus]\n G --> H[Grafana Dashboard]\n end\n```\n\n---\n\n## **Documentation**\n- [\u27a1\ufe0f Learn More About Architecture](docs/architecture.md)\n- [\u27a1\ufe0f Why Redis Manager?](docs/why_redis_manager.md)\n- [\u27a1\ufe0f Usage Examples](docs/usage.md)\n- [\u27a1\ufe0f API Documentation](docs/REDIS_MANAGER_API_DOCS.md)\n- [\u27a1\ufe0f Packaging](docs/packaging.md)\n\n---\n\n## **Acknowledgments**\n- **Redis**: The powerful in-memory data structure store used for fast data storage and retrieval.\n- **Asyncio**: Python's asynchronous programming framework, enabling efficient and scalable async operations.\n- **Bitnami Redis Cluster Docker Images**: Used in testing and integration for seamless containerized Redis cluster setups.\n- **Prometheus**: Open-source monitoring and alerting toolkit for metrics collection and visualization.\n- **Grafana**: The leading open-source analytics and interactive visualization tool, providing rich dashboards for monitoring Redis performance and related metrics.\n\n---\n\n## **Changelog**\nDetailed changelog in [CHANGELOG.md](CHANGELOG.md).\n\n---\n\n## **License**\nLicensed under the MIT License. See [LICENSE](LICENSE) file for more details.\n\n---\n\n## **Contributing**\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) to get started.\n\n---\n\n**Initially Developed by [Youssef Khaya](https://www.linkedin.com/in/youssef-khaya-88a1a128)**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Redis connection pool manager with asyncio support.",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"redis",
" connection pool",
" asyncio",
" manager",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "13b36b165a7ad27f913e786d21b3482f93a5f7965a75bd49af875ef8ab3a5104",
"md5": "94e4248589c90b9812f577cf0c8b7087",
"sha256": "d80f0d2b4ecab77bd367812275bdb57068baeba8723b898e415e6f873f0220f5"
},
"downloads": -1,
"filename": "redis_manager-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "94e4248589c90b9812f577cf0c8b7087",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12335,
"upload_time": "2025-01-25T19:58:58",
"upload_time_iso_8601": "2025-01-25T19:58:58.763020Z",
"url": "https://files.pythonhosted.org/packages/13/b3/6b165a7ad27f913e786d21b3482f93a5f7965a75bd49af875ef8ab3a5104/redis_manager-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "768b696609292055a6887bdab9f4b17bca811c80568415844169f518109bbdb3",
"md5": "694edc3bc3a3b204c6a7f07b53728489",
"sha256": "b06504811d228874cab04fa1172f59de04f3d11e59a899407d012eb1dd5c4331"
},
"downloads": -1,
"filename": "redis_manager-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "694edc3bc3a3b204c6a7f07b53728489",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13322,
"upload_time": "2025-01-25T19:59:02",
"upload_time_iso_8601": "2025-01-25T19:59:02.345749Z",
"url": "https://files.pythonhosted.org/packages/76/8b/696609292055a6887bdab9f4b17bca811c80568415844169f518109bbdb3/redis_manager-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-25 19:59:02",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "redis-manager"
}