New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support async functions in cached/cachedmethod #112
Conversation
Inspect the wrapped object, if it's a coroutine function await the future. See [inspect.iscoroutinefunction](https://docs.python.org/3/library/inspect.html#inspect.iscoroutinefunction)
Sorry, but I don't think that adding support for async functions/methods into the existing decorators is the right approach. It complicates implementation/maintenance, and - as you may have noticed by now - it's hard to get right while maintaining backwards compatibility with Python versions back to 2.7. |
@tkem thanks for the feedback and sorry for the duplicate topic. Yes, supporting 2.7 and 3.5+ at the same time is quite tricky. I'll create a new package for the async decorators. |
@hephex: That sounds great! And sorry for the delay and letting you struggle for so long - real life got in the way... |
@hephex Awesome! |
@halfdanrump I moved that code here https://github.com/hephex/asyncache |
Inspect the wrapped object, if it's a coroutine function await the future.
@tkem I copied and pasted the decorator code from the existing ones, let me know if you think it needs refactoring.
See inspect.iscoroutinefunction