load_external_module ( funcname, func ) ¶ Return a Redis client object configured from the given URLĪrguments always win. execute_command ( *args, **options ) ¶Įxecute a command and return a parsed response classmethod from_url ( url, **kwargs ) ¶ Based onĬonfiguration, an instance will either use a ConnectionPool, orĬonnection object to talk to redis.
The commands are sent and received to the Redis server. Pipelines derive from this, implementing how This abstract class provides a Python interface to all Redis commandsĪnd an implementation of the Redis protocol. Redis ( host='localhost', port=6379, db=0, password=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=None, socket_keepalive_options=None, connection_pool=None, unix_socket_path=None, encoding='utf-8', encoding_errors='strict', charset=None, errors=None, decode_responses=False, retry_on_timeout=False, ssl=False, ssl_keyfile=None, ssl_certfile=None, ssl_cert_reqs='required', ssl_ca_certs=None, ssl_check_hostname=False, max_connections=None, single_connection_client=False, health_check_interval=0, client_name=None, username=None, retry=None ) ¶ Will attempt to extract the database id from the path url fragment, if Returns an active Redis client generated from the given database URL. Releases the connection back to the pool exception redis. Return an encoder based on encoding settings make_connection ( ) ¶Ĭreate a new connection release ( connection ) ¶ Get a connection from the pool get_encoder ( ) ¶ get_connection ( command_name, *keys, **options ) ¶ In the case of conflicting arguments, querystringĪrguments always win. Once parsed, the querystring argumentsĪnd keyword arguments are passed to the ConnectionPool’sĬlass initializer.
Values that cannot be properly cast cause a If none of these options are specified, the default db=0 is used.Īll querystring options are cast to their appropriate Python types.īoolean arguments can be specified with string values “True”/”False” A db keyword argument to this function.If using the redis:// or rediss:// schemes, the path argument.Return a connection pool configured from the given URL. Otherwise only disconnectĬonnections that are idle in the pool. If inuse_connections is True, disconnect connections that areĬurrent in use, potentially by other threads. Use UnixDomainSocketConnection forĪny additional keyword arguments are passed to the constructor ofĬonnection_class. Object raises ConnectionError when the pool’sīy default, TCP connections are created unless connection_class ConnectionPool ( connection_class=, max_connections=None, **connection_kwargs ) ¶Ĭreate a connection pool. Send an already packed command to the Redis server exception redis. Pack and send a command to the Redis server send_packed_command ( command, check_health=True ) ¶ Read the response from a previously sent command send_command ( *args, **kwargs ) ¶
Pack multiple commands into the Redis protocol read_response ( ) ¶
Pack a series of arguments into the Redis protocol pack_commands ( commands ) ¶ Initialize the connection, authenticate and select a database pack_command ( *args ) ¶ check_health ( ) ¶Ĭheck the health of the connection with a PING/PONG connect ( ) ¶Ĭonnects to the Redis server if not already connected disconnect ( ) ¶ĭisconnects from the Redis server on_connect ( ) ¶ Poll the socket to see if there’s data that can be read. Manages TCP communication to and from a Redis server can_read ( timeout=0 ) ¶ Connection ( host='localhost', port=6379, db=0, password=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=False, socket_keepalive_options=None, socket_type=0, retry_on_timeout=False, encoding='utf-8', encoding_errors='strict', decode_responses=False, parser_class=, socket_read_size=65536, health_check_interval=0, client_name=None, username=None, retry=None ) ¶ ChildDeadlockedError ¶Įrror indicating that a child process is deadlocked after a fork() class redis. Releases the connection back to the pool. This means we onlyĬreate new connections when we need to, i.e.: the actual number ofĬonnections will only increase in response to demand. Were added) will be returned before None values. (having been returned to the pool after the initial None values
If the connection returned is None then creates a new connection.īecause we use a last-in first-out queue, the existing connections Get a connection, blocking for self.timeout until a connection > pool = BlockingConnectionPool ( timeout = 5 ) disconnect ( ) ¶ĭisconnects all connections in the pool. # Raise a ``ConnectionError`` after five seconds if a connection is > # not available.