Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur committed Sep 19, 2023
1 parent 3af70c2 commit e02970f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/examples/asyncio_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"\n",
"## Connecting and Disconnecting\n",
"\n",
"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."
"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."
]
},
{
Expand All @@ -39,9 +39,9 @@
"source": [
"import redis.asyncio as redis\n",
"\n",
"connection = redis.Redis()\n",
"print(f\"Ping successful: {await connection.ping()}\")\n",
"await connection.aclose()"
"client = redis.Redis()\n",
"print(f\"Ping successful: {await client.ping()}\")\n",
"await client.aclose()"
]
},
{
Expand All @@ -60,8 +60,8 @@
"import redis.asyncio as redis\n",
"\n",
"pool = redis.ConnectionPool.from_url(\"redis://localhost\")\n",
"connection = redis.Redis.from_pool(pool)\n",
"await connection.close()"
"client = redis.Redis.from_pool(pool)\n",
"await client.close()"
]
},
{
Expand Down Expand Up @@ -91,11 +91,11 @@
"import redis.asyncio as redis\n",
"\n",
"pool = redis.ConnectionPool.from_url(\"redis://localhost\")\n",
"connection1 = redis.Redis(connection_pool=pool)\n",
"connection2 = redis.Redis(connection_pool=pool)\n",
"await connection1.aclose()\n",
"await connection2.aclose()\n",
"await pool.disconnect()"
"client1 = redis.Redis(connection_pool=pool)\n",
"client2 = redis.Redis(connection_pool=pool)\n",
"await client1.aclose()\n",
"await client2.aclose()\n",
"await pool.aclose()"
]
},
{
Expand All @@ -113,9 +113,9 @@
"source": [
"import redis.asyncio as redis\n",
"\n",
"connection = redis.Redis(protocol=3)\n",
"await connection.aclose()\n",
"await connection.ping()"
"client = redis.Redis(protocol=3)\n",
"await client.aclose()\n",
"await client.ping()"
]
},
{
Expand Down

0 comments on commit e02970f

Please sign in to comment.