In brief
functools.lru_cache stores call results by argument values. maxsize limits the retained entries, and the arguments must be hashable.
Useful to know
functools.lru_cache stores call results by argument values. maxsize limits the retained entries, and the arguments must be hashable. [1]
It suits repeatable calculations rather than automatically fitting functions with side effects. Changing external data does not refresh an old result by itself. Define when the cache is cleared and whether retained values still suit the task.
Sources
For further detail and to check the information: