mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 01:56:58 +03:00
f0d9eda566
* Update aioredis to 2.0.1 * Rearranged aioredis.from_url parameters
11 lines
322 B
Python
11 lines
322 B
Python
from typing import AsyncIterator
|
|
|
|
from aioredis import from_url, Redis
|
|
|
|
|
|
async def init_redis_pool(host: str, password: str) -> AsyncIterator[Redis]:
|
|
session = from_url(f"redis://{host}", password=password, encoding="utf-8", decode_responses=True)
|
|
yield session
|
|
session.close()
|
|
await session.wait_closed()
|