long2ice/fastapi-cache

AttributeError: __aenter__

aimfeld opened this issue · 2 comments

As of fastapi-cache2[redis] version 0.1.9, I get the following error: AttributeError: __aenter__.

The error happens here: https://github.com/long2ice/fastapi-cache/blob/v0.1.9/fastapi_cache/decorator.py#L53

Version 0.1.8 works fine for me. I'm get the error both with redis 6.0 and 7.0

prob used a synced redis instead of async i.e

import redis.asyncio as aioredis

I'm going to close this as stale; the current main branch of FastAPI-Cache doesn't use the redis client as a if this is still an issue, please include a full traceback of the exception.

I do agree with lb-ronyeh here; the redis backend uses the redis client pipeline object as an asynchronous context manager (meaning it has a __aenter__ coroutine method), an exception in backend.get_with_ttl() with an attribute error on that method means the redis client isn't the asyncio implementation.