Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name 'cache' from 'functools'

All the solutions I managed to find are only on lru_cache. But in my case dir(functools) shows that that very lru_cache does reside in functools while cache does not! How can I solve this?

like image 992
Kaiyakha Avatar asked Dec 14 '22 07:12

Kaiyakha


1 Answers

The documentation for functools.cache states that it's only available from Python 3.9 onwards. If you're using an earlier version then the documentation also states that it's the same as using lru_cache(maxsize=None), so that's probably your best option.

like image 67
Kemp Avatar answered Dec 24 '22 08:12

Kemp