Message413819
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)) |
|
Date |
User |
Action |
Args |
2022-02-23 16:55:07 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, asvetlov, yselivanov, uranusjr |
2022-02-23 16:55:07 | serhiy.storchaka | set | messageid: <1645635307.48.0.136453653253.issue46622@roundup.psfhosted.org> |
2022-02-23 16:55:07 | serhiy.storchaka | link | issue46622 messages |
2022-02-23 16:55:07 | serhiy.storchaka | create | |
|