healtheworld
07/14/2023, 9:11 AMalways
vs lambda: "always"
@task(cache_key_fn=lambda: "always", cache_expiration=timedelta(seconds=20))
def my_task():
return "something"
Deceivious
07/14/2023, 12:46 PMx="always"
y=lambda : "always"
print(x)
print(y)
print(y())
Running this gives the output.
always
<function <lambda> at 0x7f324e6c7d90>
always
healtheworld
07/14/2023, 2:57 PMDeceivious
07/14/2023, 3:08 PMhealtheworld
07/14/2023, 3:38 PMDeceivious
07/14/2023, 3:39 PMhealtheworld
07/14/2023, 3:40 PMcache_key_fn
and why I agree with you:
An optional callable that, given the task run context and call parameters, generates a string key; if the key matches a previous completed state, that state result will be restored instead of running the task again.
Deceivious
07/14/2023, 3:41 PMhealtheworld
07/14/2023, 3:41 PMDeceivious
07/14/2023, 3:42 PMhealtheworld
07/14/2023, 3:42 PMDeceivious
07/14/2023, 3:43 PMhealtheworld
07/14/2023, 3:45 PMDeceivious
07/14/2023, 3:45 PMhealtheworld
07/14/2023, 3:46 PMDeceivious
07/14/2023, 3:46 PMhealtheworld
07/14/2023, 3:49 PMDeceivious
07/14/2023, 3:50 PMAn optional callable that, given the task run context and call parameters, generates a string key; if the key matches a previous completed state, that state result will be restored instead of running the task again.
__call__
method implemented ]healtheworld
07/14/2023, 3:56 PM