import asyncio
import aioredis
async def operate():
conn = await aioredis.StrictRedis(host="", port=xx, password="xx")
test = await conn.get("test")
print(test)
await conn.set("name", "li")
name = await conn.get("name")
print(name)
tasks = [
operate(),
operate()
]
if __name__ == '__main__':
loop = asyncio.get_event_loop()
# loop.run_until_complete(operate())
loop.run_until_complete(asyncio.wait(tasks))