🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

redis-manager

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-manager

A Redis connection pool manager with asyncio support.

0.1.1
PyPI
Maintainers
1

Redis Manager

PyPI version
Python versions
License

Redis Manager Logo

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

Quickstart

Install Redis Manager:

pip install redis-manager

Example Code:

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

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

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.

License

Licensed under the MIT License. See LICENSE file for more details.

Contributing

We welcome contributions! Please see our Contributing Guide and Code of Conduct to get started.

Initially Developed by Youssef Khaya

Keywords

redis

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts