mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-03 06:54:03 +03:00
14 lines
322 B
Python
14 lines
322 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()
|
|
|