Feature request: support for functools.cache
Closed this issue · 2 comments
ronkorving commented
I use @cache
in places, and would love to use this plugin to clear those caches between tests. Is that something that has a place in this project?
ronkorving commented
Okay, nevermind. It already seems to do the trick. I guess functools.cache
uses lrucache
under the hood? :)
ipwnponies commented
https://github.com/python/cpython/blob/3.9/Lib/functools.py#L652
def cache(user_function, /):
'Simple lightweight unbounded cache. Sometimes called "memoize".'
return lru_cache(maxsize=None)(user_function)
It's basically functools.partial()
on lru_cache
😄