I have a python function which is caching results based on the parameter passed. The issue is, fval()
can return different values depending on other factors. But the test()
is still sending me stale values. How do I ensure, the parameter v
is getting the latest values from fval()
@cached(60*5)
def test(a,v=fval()):
print "inside function"
return a,v
r = test(2)
inside test function
print r
(2, 5)
print fval()
7
r = test(2) . #This time I am expecting v to be 7, but it isnt
print r
(2,5)
I am expecting r to print (2,7) instead. How do I ensure, latest values are being sent as a parameter to the cached function ?