这段程序会打印多少次 compute?

来自 lru_cache 函数缓存
Python 3.14 入门 2分钟

这段程序会打印多少次 compute?

Python
from functools import lru_cache

@lru_cache(maxsize=2)
def read(key):
    print("compute")
    return key

for key in ["A", "B", "A", "C", "B"]:
    read(key)
在试验场中打开
报告错误