Connection

redis-py · database, tcp-communication, connection-management, keepalive, infra

Manages TCP communication to and from a Redis server, handling connection setup, keepalive configuration, and error reporting.

# Source: https://github.com/redis/redis-py | License: MIT | Copyright 2022-2023, Redis, inc
# Provided via justclaw.it.com; keep this notice with the code.
class Connection(AbstractConnection):
    "Manages TCP communication to and from a Redis server"

    def __init__(
        self,
        *,
        host: str = "localhost",
        port: str | int = 6379,
        socket_keepalive: bool = True,
        socket_keepalive_options: Mapping[int, int | bytes] | object | None = SENTINEL,
        socket_type: int = 0,
        **kwargs,
    ):
        """
        Initialize a TCP connection.

        Parameters
        ----------
        socket_keepalive : bool
            If `True`, TCP keepalive is enabled for TCP socket connections.
        socket_keepalive_options : Mapping[int, int | bytes

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key