lru_cache not leveraging cache with same input but passed in different ways
The problem is related to lru_cache, when I try to pass the same argument to the same cached function but in a different manner, the lru_cache will not be able to leverage cache. I would like to know if there is a better implementation that tackle the problem.
from functools import lru_cache
@lru_cache(maxsize=32)
def fn(x,y):
print('no cache')
return 1
fn(1,1)
>>>>no cache
fn(x=1,1)
>>>>no cache
fn(x=1,y=1)
>>>>no cache