Why isn't my Python decorator caching effectively with async functions?

Programming
I'm trying to implement a simple memoization decorator for several asynchronous data fetching functions in a FastAPI application, but it seems like the cache is either not hitting consistently or being invalidated too quickly. I'm using `functools.lru_cache`, but I suspect there's a fundamental misunderstanding on my part regarding its interaction with `async def` or context. Any insights on how to properly cache results for async functions would be incredibly helpful!

Sign in to join the discussion.

Login / Sign Up