mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-01 14:04:01 +03:00
13 lines
321 B
Python
13 lines
321 B
Python
|
"""Redis client module."""
|
||
|
|
||
|
from typing import AsyncIterator
|
||
|
|
||
|
from aioredis import create_redis_pool, Redis
|
||
|
|
||
|
|
||
|
async def init_redis_pool(host: str, password: str) -> AsyncIterator[Redis]:
|
||
|
pool = await create_redis_pool(f'redis://{host}', password=password)
|
||
|
yield pool
|
||
|
pool.close()
|
||
|
await pool.wait_closed()
|