Open
Description
Hi!
After upgrading to redis-py, the snippet provided in the example doesn't correctly work. It fails with the following message:
File "/root/.cache/pypoetry/virtualenvs/backend-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/root/.cache/pypoetry/virtualenvs/backend-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 159, in run_endpoint_function
return await dependant.call(**values)
File "/root/.cache/pypoetry/virtualenvs/backend-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi_cache/decorator.py", line 53, in inner
ttl, ret = await backend.get_with_ttl(cache_key)
File "/root/.cache/pypoetry/virtualenvs/backend-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi_cache/backends/redis.py", line 14, in get_with_ttl
return await (pipe.ttl(key).get(key).execute())
AttributeError: 'coroutine' object has no attribute 'get'
We did some tests, and it seems that the snippet provided in readme aioredis works well.
However, when we change import aioredis
to from redis import asyncio as aioredis
as advised in aioredis's docs, the code fails with the same error, as above.