or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aioredis@2.0.x
tile.json

tessl/pypi-aioredis

tessl install tessl/pypi-aioredis@2.0.0

asyncio (PEP 3156) Redis support

Agent Success

Agent success rate when using this tile

98%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

97%

task.mdevals/scenario-2/

Redis Server Health Monitor

Build a Redis server health monitoring utility that checks server status and provides database statistics.

Capabilities

Server Health Check

  • The monitor pings the Redis server and returns True if the server responds correctly, False otherwise @test
  • The monitor echoes a message to the server and verifies the response matches the sent message @test

Database Statistics

  • The monitor retrieves the count of keys in the current database @test
  • The monitor retrieves comprehensive server information including version, memory usage, and connected clients @test

Database Management

  • The monitor can flush all keys from the current database @test

Implementation

@generates

API

import asyncio
from typing import Dict, Any, Optional

class RedisHealthMonitor:
    """
    A Redis server health monitoring utility.

    This class provides methods to check Redis server health status,
    retrieve database statistics, and perform database management operations.
    """

    def __init__(self, redis_url: str = "redis://localhost"):
        """
        Initialize the health monitor with a Redis connection URL.

        Args:
            redis_url: Redis connection URL (default: "redis://localhost")
        """
        pass

    async def connect(self) -> None:
        """Establish connection to the Redis server."""
        pass

    async def disconnect(self) -> None:
        """Close the connection to the Redis server."""
        pass

    async def check_health(self) -> bool:
        """
        Check if the Redis server is responsive.

        Returns:
            True if server responds to ping, False otherwise
        """
        pass

    async def echo_message(self, message: str) -> bool:
        """
        Send a message to the server and verify the echo response.

        Args:
            message: The message to echo

        Returns:
            True if the echoed message matches the sent message, False otherwise
        """
        pass

    async def get_key_count(self) -> int:
        """
        Get the number of keys in the current database.

        Returns:
            The count of keys in the current database
        """
        pass

    async def get_server_info(self) -> Dict[str, Any]:
        """
        Retrieve comprehensive server information.

        Returns:
            Dictionary containing server information including sections like
            'server', 'clients', 'memory', 'stats', etc.
        """
        pass

    async def flush_current_database(self) -> bool:
        """
        Remove all keys from the current database.

        Returns:
            True if the operation succeeded
        """
        pass

Dependencies { .dependencies }

aioredis { .dependency }

Provides asyncio Redis client functionality for server health checks, database inspection, and management operations.