What does the functools.lru_cache decorator do?

Python Developer Medium

Python Developer — Medium

What does the functools.lru_cache decorator do?

Key points

  • lru_cache stores function results based on arguments
  • Improves performance by avoiding redundant calculations
  • Useful for functions with expensive computations
  • Does not limit the rate of function calls

Ready to go further?

Related questions