Vidyalelo
Python · Q23

Decorators in Depth

Programming · Python · question 23

Q23

What is the purpose of the @lru_cache decorator in Python?

A.
To limit the number of decorator applications
B.
To cache the last used decorator
C.
To cache function results with a limited size
Answer
D.
To cache only class methods

Answer: Option C

Solution

Answer: Option C
Solution:
The @lru_cache decorator is used to cache function results with a limited size using the Least Recently Used strategy.