|
15 | 15 | "\n",
|
16 | 16 | "## Connecting and Disconnecting\n",
|
17 | 17 | "\n",
|
18 |
| - "Utilizing asyncio Redis requires an explicit disconnect of the connection since there is no asyncio deconstructor magic method. By default, a connection pool is created on `redis.Redis()` and attached to this `Redis` instance. The connection pool closes automatically on the call to `Redis.close` which disconnects all connections." |
| 18 | + "Utilizing asyncio Redis requires an explicit disconnect of the connection since there is no asyncio deconstructor magic method. By default, a connection pool is created on `redis.Redis()` and attached to this `Redis` instance. The connection pool closes automatically on the call to `Redis.aclose` which disconnects all connections." |
19 | 19 | ]
|
20 | 20 | },
|
21 | 21 | {
|
|
39 | 39 | "source": [
|
40 | 40 | "import redis.asyncio as redis\n",
|
41 | 41 | "\n",
|
42 |
| - "connection = redis.Redis()\n", |
43 |
| - "print(f\"Ping successful: {await connection.ping()}\")\n", |
44 |
| - "await connection.aclose()" |
| 42 | + "client = redis.Redis()\n", |
| 43 | + "print(f\"Ping successful: {await client.ping()}\")\n", |
| 44 | + "await client.aclose()" |
45 | 45 | ]
|
46 | 46 | },
|
47 | 47 | {
|
|
60 | 60 | "import redis.asyncio as redis\n",
|
61 | 61 | "\n",
|
62 | 62 | "pool = redis.ConnectionPool.from_url(\"redis://localhost\")\n",
|
63 |
| - "connection = redis.Redis.from_pool(pool)\n", |
64 |
| - "await connection.close()" |
| 63 | + "client = redis.Redis.from_pool(pool)\n", |
| 64 | + "await client.close()" |
65 | 65 | ]
|
66 | 66 | },
|
67 | 67 | {
|
|
91 | 91 | "import redis.asyncio as redis\n",
|
92 | 92 | "\n",
|
93 | 93 | "pool = redis.ConnectionPool.from_url(\"redis://localhost\")\n",
|
94 |
| - "connection1 = redis.Redis(connection_pool=pool)\n", |
95 |
| - "connection2 = redis.Redis(connection_pool=pool)\n", |
96 |
| - "await connection1.aclose()\n", |
97 |
| - "await connection2.aclose()\n", |
98 |
| - "await pool.disconnect()" |
| 94 | + "client1 = redis.Redis(connection_pool=pool)\n", |
| 95 | + "client2 = redis.Redis(connection_pool=pool)\n", |
| 96 | + "await client1.aclose()\n", |
| 97 | + "await client2.aclose()\n", |
| 98 | + "await pool.aclose()" |
99 | 99 | ]
|
100 | 100 | },
|
101 | 101 | {
|
|
113 | 113 | "source": [
|
114 | 114 | "import redis.asyncio as redis\n",
|
115 | 115 | "\n",
|
116 |
| - "connection = redis.Redis(protocol=3)\n", |
117 |
| - "await connection.aclose()\n", |
118 |
| - "await connection.ping()" |
| 116 | + "client = redis.Redis(protocol=3)\n", |
| 117 | + "await client.aclose()\n", |
| 118 | + "await client.ping()" |
119 | 119 | ]
|
120 | 120 | },
|
121 | 121 | {
|
|
0 commit comments