Serhiy Storchaka <[email protected]> added the comment:
async_lru_cache() and async_cached_property() can be written using that
decorator. The implementation of async_lru_cache() is complicated because the
interface of lru_cache() is complicated. But it is simpler than using
_lru_cache_wrapper().
def async_lru_cache(maxsize=128, typed=False):
if callable(maxsize) and isinstance(typed, bool):
user_function, maxsize = maxsize, 128
return lru_cache(maxsize, typed)(reawaitable(user_function))
def decorating_function(user_function):
return lru_cache(maxsize, typed)(reawaitable(user_function))
return decorating_function
def async_cached_property(user_function):
return cached_property(reawaitable(user_function))
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46622>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com