Redis – How to extend the lifespan of an object under asynccontextmanager into a background task in FastAPI?
I use an object that needs a startup and a teardown process (load from/save to cache, for example) in a FastAPI endpoints. I used a asynccontextmanager to manage the context of an object, but I also want to process the…