The functools module in Python provides powerful functions - cache, cached_property, lru_cache - to optimize performance by storing results of expensive computations.
The cache function stores function results for reuse when the same inputs occur again, making it ideal for computationally expensive pure functions.
The cached_property function transforms a class method into a property that computes its value once and caches it for the instance, perfect for expensive calculations in classes.
The lru_cache function offers a configurable Least Recently Used (LRU) cache for memoization, supporting caching up to a defined size and providing introspection features.