Python·100 questionsHow to cache computations (functools.lru_cache)?SaveUpdated: 2026-08-31Answer•@lru_cache(maxsize=...).•Works for pure functions.•Arguments must be hashable.•cache_clear() clears cache.•For complex cases — external cache (Redis).Ask AI to clarifyWas this answer helpful?HelpfulNot helpfulSuggest an improvement