Manages TCP communication to and from a Redis server, handling connection setup, keepalive configuration, and error reporting.
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] | object | None
Mapping of TCP keepalive socket option constants to values, for
example `{socket.TCP_KEEPIDLE: 30}`. If left unspec
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key