Examveda

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

D. To cache only class methods

Answer: Option C

Solution (By Examveda Team)

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

This Question Belongs to Python Program >> Decorators In Depth

Join The Discussion

Related Questions on Decorators in Depth