It's an implementation of ConnectionPool in redis.py

Available connections and used connections

List of connections available in _available_connections Total number of connections created so far with _created_connections _in_use_connection sets the connection you are currently using

If there is a connection that can be used from _available_connections with the get_connection method, it will be fetched by pop. If not, create a new connection with make_connection and add it to _in_use_connection

Return the connection to pook with the release method. (remove from _in_use_connection, _available_connections and append)

Open the pool with disconnect

How it is actually used

In the execute_command method of the StrictRedis class Get connection from pool with get_connection method Execute a command using a connection, and if the command execution ends normally or abnormally, return a connection with (finally) release (in the case of an abnormality, discard the connection from the pool and create a new connection)

Huh

Recommended Posts

It's an implementation of ConnectionPool in redis.py
Implementation of quicksort in Python
Implementation of login function in Django
Implementation of life game in Python
An implementation of ArcFace for TensorFlow
Implementation of original sorting in Python
The story of an error in PyOCR
Explanation of edit distance and implementation in Python
Maximum likelihood estimation implementation of topic model in python
About testing in the implementation of machine learning models
[Golang] Specify an array in the value of map
Overview of generalized linear models and implementation in Python
Variational Bayesian inference implementation of topic model in python
A reminder about the implementation of recommendations in Python
RNN implementation in python
ValueObject implementation in Python
Implementation of Fibonacci sequence
SVM implementation in python
[Reinforcement learning] Explanation and implementation of Ape-X in Keras (failure)
How to get an overview of your data in Pandas
Explanation of CSV and implementation example in each programming language